Tariffs for hiring non citizens.
Force companies to follow all the same employment laws for employees and contractors in other countries.
The cost of living of an Indian developer is way less than that of a US one, especially if the US one is in a high cost of living area such as SF or NYC. How can the US worker complete when they have US housing and college costs, not Indian ones, that need to be paid for?
Offshoring like this is allowing dumping of below-cost labor into US markets. Great for US C-suite folk and their profit-based bonuses, and for lobbyists getting paid big bucks to let this happen, but no so great for US citizens trying to make a living as software developers, which one might have thought would be a thing the US would strategically want to encourage, rather than strengthening a foreign country.
In my experience, US workers, even with much higher wages, are simply better than Indian workers being paid much lower wages. Note that Indians being paid US wages, in the US, are fine - you just can't expect much if you're paying peanuts.
I have had experiences where entire offshore teams have contributed significant negative value. This false economy is as false as they come.
I think a bigger danger to US wages is European offshoring.
Either way, I think this gets away from the premise and starts getting into reasons not to do it (theoretically, you're losing some new jobs that would otherwise be created) more than reasons it's impossible
Historically protectionism was a major part of how the US developed its economy but typically countries become less protectionist once they have highly developed economies (because free trade tends to benefit them more).