I'm currently "training for a STEM job", as you would put it, by pursuing at degree in computer science. I don't think my choice was a mistake. I see the fact that our industry is a global one as an opportunity, not a threat.
The US is in the enviable position that a lot of other countries' best and brightest want to work here. By restricting the number of H1Bs that companies can hire, the goverment is squandering some of that opportunity. And it's doing so at the behest of people like you, who think of jobs like poker chips--little non-replaceable entities that you can gain, lose, give away, or have "taken" from you. That's not what jobs are. Consider, for example, what happens when Intel hires a rockstar Chinese chip fab engineer. That engineer creates a cadre of supporting positions--testers, integration engineers, PMs, EE interns from the local college, etc. Maybe he, a litho expert from India, and an industrial robotics expert from the US end up leading a project to build a new fab in America. Maybe that fab leads to a couple million processors every year that are being etched in America instead of China.
Collaboration like this is what put America on top of the innovation food chain in the first place. Google was started by a Russian guy and an American who were grad students at Stanford. Tesla Motors was co-founded by an American and Elon Musk.
The way I see it, every country starts with roughly the same bell curve of talent and ability. Some have great education systems and make the most of it. Others, not so much. Where America sits on that scale is for another post. But the crazy thing is: America can cheat. We can cherry-pick the smartest and most innovative people from places like India and China. We can skim off the top of a pool of 2.5 billion people, simply by letting them in.
That some of us think it's good for our government to prohibit us from hiring those people boggles my mind.