Because those engineers were free to create the value that they needed and only the value that they needed. Windows Server and OSX Server were/are not unfettered. They, therefore could not offer a better value.
https://www.youtube.com/watch?v=rV0a-b_VhBg
Google and Amazon are competing with their own Linux OSes. Even IBM bought 30% of RedHat almost 30 years ago. Windows is developing their own Linux OS now too, Azure Linux. Windows Server is down to 40% in their cloud Azure environment. I'm just guessing that's because many long term contracts are ending and the companies associated have been migrating away from Windows Server. Hence the need for Azure Linux. OSX server flopped big time twenty years ago. Apple had to shutdown their entire XServe division. You don't always have to sell the software or OS to make money off of it. Especially when there is heavy competition. It's like restaurants in the US giving away free tap water when you sit down to eat. There are a lot of ways to compete for dollars in a capitalist world.
/u/Zak did a pretty good job summing it up.
These servers are hosting custom software. The devs can develop for any hardware and OS combination. So the choice is largely performance, features, and price. Free is the best price in a capitalist world. Free isn't the only price though, companies are just fine spending money if they are getting a better value. They just aren't with Windows Server and didn't with OSX server, they don't offer a better value. They aren't more performant and they don't offer any features that make it worth the money or risking vendor lock-in. With Linux, if the value you need isn't there, anyone is free to create the value that is needed, with zero limitations. And they only need create the value they need.