And then, since you have all these integrated functions, you can spend headcount optimizing datacenter spend down. Hire a team to re-write PHP to make it faster literally pays for itself. Or kernel engineers. Or even HW engineers and power generation. And on the product side, you can do lots of experiments where a 1% improvement in ad revenue pays like the entire department's wages for the year. So you do a lot of them, and the winners cover the cost of the losers. And you hire teams to build software to run more experiments faster and more correctly.
The brakes on this "flywheel of success" is the diseconomies of scale outweighing the economies. When the costs of communicating and negotiation are higher internally than those external contracts you previously subsumed. When you have two teams writing their own database engine competing (with suppliers!) for the same hires. When your datacenter plans outpace industrial power generation plans. When your management spins up secret teams to launch virtual reality products with no legs.