Wasn't it automation and specialization of labor that gave the western world the middle class?
Sort of. It started in the ag sector. Early 1800's ag was the dominant sector and labor intensive. Machines began reducing the need for manual labor around the time of the Civil War, and farm labor peaked around 1910.
At the same time though invention and manufacturing was exploding, and required a great deal of labor. So the labor economy shifted. As tech advanced, the need for labor in manufacturing reduced. Peak labor there was about 1980.
Around that time though computers started taking off, shifting the need for labor again. Now we are in the services/information age. The demand for that is heading for that peak now.
Automation though, is going to reduce the need for that, as well as what is left in manufacturing and agriculture in one fell swoop. It's going to be a vertical integration of labor all into machines.from bottom to top, with a few technical people to monitor and correct what the AI's can't.
In some ways it will be an all ownership economy. You will either own a farm and produce for yourself, a shop or store serving the few with income, or an owner of a company that produces X.
What there won't be is much demand for labor and skills. That middle class income manager or technician with high skills that lives in the burbs will become a very scarce. Low skilled labor will be almost nonexistent. It will be a very disperate economy of two extremes and little in the middle.