This is a compelling perspective. But putting sales or import restrictions in place right now would be damaging in the short term both for the manufacturing partners and the US. They’ve already put some export restrictions in place (ie preventing nvidia from selling their most powerful chips to china).
In terms of nearshoring - that’s a good idea too but I think the workforce training would be even more difficult than it has been in the US and it would be less popular politically as you said. (Side note: PR is part of the US - maybe you meant Costa Rica)