Bottom line is, AI and automation can cause short term pain, but the upside is enormous. Successful countries will be those that can manage that transition.
This sounds great in theory, and I fully agree, but the system of compensation and wealth distribution will need to be turned upside down for that to happen.
The value created by current and future automation will somehow need to be captured and distributed to people whose financially profitable jobs are going to be replaced with unprofitable, but socially-beneficial work, there's really no way around it. Those people will still need to be fed, housed and have access to at least basic luxuries.
Furthermore, what do we do in a future "ideal" world where robots and AI are capable of providing basic necessities to sustain every human alive? Capitalism would likely break down one way or another, with branching paths that either take us to an utopia or a nightmare dystopia.
I think at some point this will stop being true. Obviously people displaced from jobs in the industrial revolution found other work, but at some point we can't expect the bottom 10% of a population (in terms of ability to perform non-menial jobs) to do "higher value" work.
I don't say this in any disparaging way and I am not in any way demeaning them or suggesting they don't matter. But they don't necessarily fit into society's expectations for "higher value" work.