I just did a quit net search for some history of U.S. immigration laws. Didn't bother with the wikipedia entry. Did find a "brief" history at the Cato Institute (a libertarian site):
https://www.cato.org/policy-analysis/brief-history-us-immigration-policy-colonial-period-present-day#conclusionIt covers the main changes in laws from pre-colonial times up to the beginning of Biden's administration. It seemed a long read and I got to about the 1950s before skipping to the end. I'll go back and read the skipped portion later.
Anyhoo, it seems that immigration laws changed with shifts in wind direction. Cultural fears and prejudices often shaped the laws, other times economic needs and desires. For example, if I understand correctly, Mexican migrants and immigrants were sometimes encouraged, sometimes not - so deported, sometimes both actions happening at the same time. The latter I think was when the Bracero Program and Operation Wetback were operating: "Some illegal immigrants took “a walk‐around the statute” to gain a bracero worker visa—a process where they were driven down to the Mexican border by the INS or Border Patrol and made to take one step across the border and then immediately reenter the United States legally with a bracero work visa."
The article seems to conclude current immigration laws are an inconsistent patchwork of past laws in need of correction by congress.