I'm a naturalized US citizen who came here on a work visa originally so I get it.
We are however in very different times. In the 2010s, they couldn't employ enough software engineers. Now? There's permanent layoffs. Every year all these companies now lay off 5-10% of their employees. It's become the "up or out" culture of Corporate America.
The only reason they do this is to suppress wages. They want to claw back the gains of the 2010s. Every sufficiently sized company reaches a point where the only way they can continue to grow profits is to cut costs and raise prices. Labor is a huge cost.
Despite supposed protections, it's clear that people on work visas get paid less. There's an inherent lack of mobility and the consequences of getting fired or laid off and not being able to find a job are extreme: depending on what type of visa you have you may have to leave the country within as little as 10 days (but typically 60).
So I think companies should lose their ability to not only sponsor green cards but also hire nonresidents if they engage in layoffs for a certain period. I'm thinking 2-3 years.
The employment situation for software engineers is now dire, unlike a decade ago, so it actually makes sense to curtail foreign employment.