I'm pretty sure that the economics were aligned with getting bought out by someone. Upselling people who used the free product was not making them profitable and they weren't on the path to profitable.
The GitHub story is complex. There was a time years ago when they were profitable: https://signalvnoise.com/posts/2486-bootstrapped-profitable-... They and Sidekiq were the poster children of bootstrapped profitable businesses around open source. Something very clearly changed (most likely raising a boatload from VC firms and the ensuing perils) that flipped the situation.