Before getting into it, I'll say that I agree on policy. It is pretty dumb to send CS PhD recipients from reputable universities home, or force them to go through the idiocy of temporary work visas with dual intent to remain in the us. It makes more sense to just grant residency.
I just have a very, very different opinion about the rest of this.
First, I think that PhD programs in the sciences are generally a poor return on investment relative to other options (the professional degrees, in particular). Here's a link to a RAND study that concludes that the American allergy to STEM PhD's is rational and market-driven.
My guess would be that PhDs in CS are a better investment than science degrees in the aggregate. However, PhD degrees in CS still have sky high attrition rates and time to completion compared to the professions, and salary and employment prospects long term for top students who could attend elite law, medical, business, or other professional schools are still better than what is offered by PhD programs.
In short, I think that any "shortage", to the extent that it exists, is market driven and rational. PhD programs need to face a reckoning, and they need to change. The RAND study makes some good suggestions, but PhD programs won't change if they can position themselves as gatekeepers to US residency. They'll just wave goodbye to the Americans who already have residency and don't have to go through this bullshit, and continue their abuse of students who have fewer legal options to reside here.
This brings me to my next disagreement - that PhD students make up the costs of their scholarship "to some extent." I think this is a vast understatement. Talented PhD students in STEM fields are profit centers for universities. The work product of a 5th year PhD student in a biochemistry lab vastly exceeds the minor stipend this student is paid. This is why PhD programs like to string out their students. It's a big reason for why they won't move to the professional model (advocated by the RAND study).
In short, I hold opposing positions here, depending on which perspective I take. Yes, PhD graduates from STEM programs should be granted residency, it's nuts to send them home or force them to jump through hoops. No, PhD programs should not, under any circumstances, hold the power to grant residency to international students. They will abuse this - they already do.