This is a coordination problem first and foremost. The solution is to tax the shit out of supply chains that don't provide the basics.
...
And yes, development economics is ugly. There's no royal road from subsistence farming to Switzerland-level, but whatever road there is it's not composed of separately inscrutable steps. It's perfectly okay to strive to make each step better and less horrible. Just as on the other side of globalization it's not some unknowable force closing non-profitable mines, and again it's a coordination problem that the disadvantaged folks and regions of globalization, in the developed economies, only got a big pat on the back. (And yes yes, there were a few programs to try to retrain unemployed people here and there, but it was simply a waste of money, because they got no help to mentally deal with the situation. Folks should have been encouraged very heavily to move where the jobs are instead of wallowing in semi-deserted corporate towns of misery.)