It can also be a decision that's made from the bottom up. At any large company, as long as there's growth and success, every development team is going to either have more work than they can handle or can think of something they could do if they had more devs. So they're going to ask for more headcount. (Or cynically, some managers view headcount as a metric of their personal career progression and will ask for more headcount regardless.) You don't usually see senior management say, "let's hire 40,000 engineers". Instead, you have maybe 8,000 line managers all saying, "I want five more engineers". If anything, they are all saying, "I want six more engineers" and senior management has to figure out how to cut that down from 48,000 to 40,000.
OK, so what if 20% of Google's engineers generate 80% of the value? As long as either the other 20% of the value breaks even with the cost of the other 80% of engineers, or there's potential for explosive growth somewhere in the 80% of work that's being done outside of the core business, it's a smart decision. Google's not going to stop Microsoft from hiring enough engineers to make Bing just as good of a search engine. And if that's all they wanted to do, they could just go on LinkedIn and offer to double the salary of everyone in the Bing division and it would still cost less.