But they don't buy all the competition. At least 3 forces prevent that:
1) they have to recognize that the target company _is_ competition. For example, Larry and Sergei tried to sell their young Google company to Excite for $1 million. Excite wasn't interested. They also tried to sell to Yahoo. Yahoo wasn't interested either. (Yahoo became interested much later when Terry Semel was the CEO but by then Google was already worth more than $5 billion.) If you can't see the small company as a threat, you ignore them even if they prostrate themselves before you begging you to buy them. Excite and Yahoo both couldn't see that the little upstart Google was going to make them irrelevant.
2) The competition has to willingly say "yes" to being acquired. Some say "no". A famous example of that is Facebook saying "no" to Yahoo's offer of $1 billion in 2006. Later in 2010, Microsoft and Steve Ballmer also wanted to buy Facebook for $24 billion and again, Mark Z refused. Bill Gates himself refused Ross Perot's early offer of $7 million to buy Microsoft.
3) the competition becomes too expensive to buy. Ebay toyed with the idea of buying Airbnb but the home-lodging company got way too expensive way too fast for Ebay to execute a deal
Acquiring _all_ the competition requires identification of threats (that don't look like threats on the surface) and cooperation from the targeted companies and available funds. You don't get always get that combination and that's why Google and Facebook are not subsidiaries of Yahoo.