“If the US would cut the H1B visa program and stop letting foreigners with earned American Ph.D.s stay after graduating.”
Do you think the locals who are now convinced to become roofers and plumbers will somehow fill the vacancies? If so, that would solve the problem. If not, the STEM departments would disappear. Perhaps the funding can then be routed to local votechs where 10th graders can learn how to plug in wall sockets and carry shingles safely.
It is a question of supply and demand. Take away H-1B visas and salaries for Americans go up. The incentive to study for a STEM degree also goes up. Everything works out for the best. Not hard to figure out.