Imagine a simple world with two countries (1 and 2) and two commodities (A and B). It might be that country 1 has something that allows them to produce both A and B with greater efficiency than can 2. But even when that's the case, they (and the whole world) do better when they continue to concentrate on producing the one for which they have the greatest advantage (say, A). Even if 1 can also produce B more efficiently than can 2, it works out better if they ignore that, leaving it to 2, and just concentrate on producing all the A they can.
That solution doesn't change if there are more countries and more commodities. It might make the big picture more complicated, but it remains a better solution for both 2 and for the entire world if 2 concentrates on producing whatever it's best at.
(Note that this is purely based on economics of commodities, and not national security. When some of those commodities are things like "missiles", it may well be that a country things they need to have a guaranteed secure supply, should one of their trading partners decide not to be friends anymore.)
But the most important part is when a country chooses to not specialize in something, they have the ability to specialize in something else. US has to decide whether the opportunity cost of getting manufacturing back is worth it, given it won't be a very employable area with all the automation.
Jobs of some sort. Teachers, construction workers, health care workers, programmers. Farmers, utility workers, electricians and craftsmen of different sorts. Case workers for the country's child protection agency. Folks that speak the local language who work in call centers. Sure, some of these are low-paying jobs, but lets face it: so are some factory jobs (i've worked in one and had friend that worked in others, which pay a little above minimum wage).
Simply put, you aren't going to ship off all the jobs. So they aren't the best at manufacturing? So what? Obviously, if they have buying power, the country has some other strengths. They simply wouldn't show up when looking at manufacturing only.