Your first example is Amazon using a corporate structure maneuver to evade employee classification. That is not outsourcing, that is attempting to evade the law. Your second example, while accurate [1] (and a contributor to the hollowing out of the middle class), is trending back to the US due to Inflation Reduction Act subsidies [2] (battery factories highlighted as they are the major component of EVs).
[1] https://www.congress.gov/116/meeting/house/109127/witnesses/...
[2] https://electrek.co/2023/05/31/north-america-battery-factori...