In the 1920s and 1930s the US had:
- Forced labor
- Peonage
- Debt servitude
- Jim crow laws
The 19th amendment was ratified in 1920, so that barely missed the cutoff.
The US has not been some beacon of moral righteousness for the majority of its existence.
But you are right that it is ending, just wrong about what: it’s the high economic activity that attracted people which is disappearing thanks to the same people that hate migrants.
I'm not sure there's a "just" here: compared to peer countries, the US is either middle-of-the-pack[1] or significantly more accepting of immigrants[2] depending on which number you pick.
(This isn't to somehow imply that the US isn't hostile to its immigrants, because it is. But the question is whether it's more hostile.)
[1]: https://www.visualcapitalist.com/charted-the-share-of-foreig...
[2]: https://www.oecd.org/en/data/indicators/stocks-of-foreign-bo...
For example, giving funding to USAID to try to stop the spread of Ebola helps people in DRC, Uganda, and other countries directly affected, but can also help the US not have Ebola spread here.
Helping Mexico improve their economy can help people in Mexico not immigrate to the US.
I believe our generosity also benefits us much more than we can see when our perspective collapses and we see life from fewer and fewer dimensions. And I think we can collapse into the "us vs them" mindset that so many others have collapsed into or we can go the other direction and realize it's "us with them" and then we look at generosity differently.