the long work hours, the frequent relocation, limited ability to change employers, being far away from spouse/children for long periods of time, and and straight up dishonesty and abuse. It's thankless work and the ones who do it are the ones who find it's much better than what they had back in their home countries where conditions are worse. Workers want jobs just like anyone else. No one is trying to "steal" a job from someone else.
You make very sensible points. I'll add the nature of IT as a cost center (rather than revenue generating) in many companies is why much of it is contracted out. Americans don't like the contracting lifestyle. I certainly don't. It's taken me many years and switching companies several times with several periods of unemployment before I got to join a great company that values it's people and invests in career growth.
I will say that the job openings are real, even though they are not what I want. I get plenty of recruiters contacting me about opportunities for testing/development/system admin/etc. in the red areas of the Midwest and rural South. Places where my grandparents were smart enough to steer clear from because they were still segregated when they immigrated to America.
Tech apprenticeships would be a great way for companies to grow their own talent. It happens in some software and services companies who hire paid interns as a form of recruiting talent. The university I attended had a mandatory requirement that everyone in my program must do co-op/internships as a requirement to graduate. It was difficult finding internships but it is doable. Colleges and tech schools should do a better job partnering with employers to facilitate this.
Way too many employers and clients have completely unreasonable expectations for how much experience and training a person should have while offering a very low wage and no job security.
Automation has always been the biggest threat to jobs. Elevator operators were put out of work by buttons. Lots of construction and excavation workers were put out by machinery like backhoes and bulldozers. Same with farming and factories. When I worked in testing/QA it was becoming increasingly automated with scripts that would replace lots of tedious manual testers. So Americans won't do it and increasingly humans won't do it.