During the industrial revolution this kind of massive creation of unemployment was offset or mitigated by 2 things: a welfare state and the creation of a new labour-intensive industry to mop up the workers. In the 19thC the latter was railways (privately funded by the rich). In the 21stC it could be space (if we did it the human-intensive way, which would be expensive) or massive infrastructure, education and eco projects. I don’t think private capital is as active these days though so it’ll have to be capital taxes and public spending. Unless the rich want to start changing the world again?