America is a shrine to capitalism. Capitalism has driven most of the outsourcing that American companies did first to Japan (ship building, autos, then semiconductors), then to Korea (again shipbuilding, autos, semiconductors, smartphones), then to Taiwan (shipbuilding, semiconductors). Then to China- which is now a problem because the divergence between the US and CN post-Xi.
Tesla and Apple's investments in China specifically supercharged the EV and smartphone industries in China. Yes it meant that those companies benefitted from Chinese manufacturing, but it also trained Chinese industry to build those products at scale.
Also America did not reinvest enough in developing new industries or retraining in the regions which lost those industries.
America should never have moved critical manufacturing away from the US (certain shipbuilding, latest-edge semis) etc.