“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.”
You assume that the locals are not into STEM because of lower salaries, where they are the highest compared to all other fields.
Wages for software and engineering are flat for 20 years. I know from first hand experience.