"Capital" is the key word here. Old man Marx was right when he said that capitalism is inherently self-contradictory... it's just that it took a while for that to fully manifest, and it is not in a way he expected.

Consider what capitalism is, again, from a Marxist perspective. It is an economic mode of production that has two main classes: the capitalist class, which is characterized by the ownership of the means of production (aka capital); and the worker class, which is characterized by the lack of said ownership. The capitalist class, by virtue of owning the means of production, also owns any surplus value created using them.

However, because your average capitalist has too much capital to be able to utilize it to its full extent, in order to maximize the surplus value generated from that capital, they need the workers. So, they effectively rent out the means of production to the workers (note: this includes the entire managerial chain involved, up to CEOs, and even owners themselves to the extent that they operate in a managerial capacity), who generate the actual surplus value, but then pay most of it back to the owner of the capital as rent. On the other hand, the workers, without access to means of production, cannot generate surplus value for themselves. So they have to go and rent those means from the capitalists who own them.

The resulting arrangement manifests as employment and wages, and that's how we nominally describe it. But fundamentally it's all about rent and rent-seeking. The reason why this arrangement works in practice is because, within this established framework (i.e. unless you dispute legality of ownership of capital), both classes need each other to get any value out of it.

Consequently, the reason why it's breaking apart with advent of widespread automation is because it breaks the dependency of the capitalist class on the workers. Automation is essentially capital that generates surplus value all by itself. This means that the entire production/consumption cycle that drives the economy becomes contained to the capitalist class. Simply put, if you have a robot that can do X for free, and the other guy has a robot that can do Y for free, and both of you need X+Y, then you only need to trade between each other. You don't need to trade with (e.g. hire or contract) anyone who does not have any robot that does anything useful. Effectively, everyone who doesn't own any means of production - i.e. the majority of the population in modern societies - become economically redundant in all respects, and cut off from the economy as a result.

This is the point at which the question of who owns the capital - i.e. the automation - becomes paramount. The existing owners can try to avoid pressing that point by willingly taking a part of the surplus value that automation generates for them, and sharing it with all those that don't have any capital of their own, as a direct wealth transfer. This is UBI and other similar schemes. It's probably where we're heading in the medium term, but I doubt it would be a stable arrangement for too long - there's just too many inherent questions about fairness here, and such a scheme would also have basically zero social mobility between the have-automation class and the have-nots, that would further accelerate resentment.

Longer term, we're probably looking at some form of shared ownership of the means of production. Which, combined with the post-scarcity that automation should result in, would, in fact, be communism in the strictest definition of that term. If we do get there, it would be the ultimate irony in that it would be capitalism as a socioeconomic system, rather than socialism, building the road there, for all the efforts of the latter and the indifference of the former...