We also have to think that a lot of in-between steps are going to happen in that scenario. For example, consider that Coca Cola could automate all production, thus minimizing the costs of Coca Cola. However at the same time, all other companies are also automating everything, thus also minimizing the number of Coca Cola customers ... they'd end up with this huge automated factory making Coca Cola that there isn't any market for. Which just implies that they wouldn't have built that factory in the first place. The scenario of vast automated factories and nothing else thus won't happen, because there will be an equally vast lack of any customers.
It could be viewed as a Prisoner's Dilemma situation however. "Cooperate" is for the company to hire workers to make your product, where "backstab" is for the company to automate everything. The problem is that from any one company's point of view, automating everything is the way to go, but from a big-picture view, when all companies automate they crash the entire economy: no customers, no market, very few actual automated factories in existence. This may be how communism actually comes about. All the companies stab each other by shedding labor and automating in order to get a relative advantage, only to find nobody has a market anymore at the end of it, and the economy gradually becomes more and more dependent on direct government stimulus.