Sure, self-hosting is a great option for very large projects, but a random python library to help with an analytics workflow isn’t going to self-host. Those projects, along with 27,999,990 others have chosen GitHub, often times explicitly to reduce the barrier to contribution.
Also, all of those examples are built on thousands of other FOSS projects, 99% of which aren’t self-hosting. This is the same as arguing only Amazon is a bookseller and ignoring the thousands of independent book publishers creating the books Amazon is selling.
Just looking at employers in my professional career. Two. One for 15 years then the current for 3.
Looking at my direct and diagonal leaders, they seem to average 3-5 years a role, and I consider staying with my prior employer for so long a mistake. I made career progression and promotions there, but it still slowed me down vs changing employers.