The middle class is shrinking because it is becoming obsolete. That which serves no purpose atrophies.
The most efficient industrial society has a small ruling class and a large working class. The small ruling class controls manufacturing and distribution. The working class provides labor. It has only the buying power granted it by the ruling class. Under streamlined management, large corporations can operate their manufacturing facilities and big-box retail stores with a minimal middle management class. The economy can be manipulated to keep even these slightly elevated functionaries under sufficient financial stress to keep them in control.
The labor class doesn't need to be well educated, so the ruling class doesn't need to spend a great deal on public schools. Design engineers and other technical people will come from the ruling class, but part of their challenge is to design systems that can be operated by people who are trained, rather than educated.
Preserving the illusion of a free society, the labor class may believe it has mobility and free will, but freedom, as they say, is not free. You have to fight management's wars for them. And you are only as free as your budget allows.
It's essentially a slavery economy with free-range slaves. They don't run away because there's nowhere to run and they don't know they're captives.