Tech workers have the benefit of hindsight, having seen U.S. manufacturing jobs get decimated in the last few decades.
A lot of fields already have built in protection from foreign competition. For instance, most if all states require that anyone conducting telemedicine work needs to be both licensed in the state were the service is being performed.
Given the leftward drift of the Democratic party and Republican's newfound disdain for the big tech companies and things like HB1 visas, I would be shocked if we don't see some significant restrictions on how foreign workers are used in the tech sector.
If you’re writing software for the world, you might have temporarily enjoyed a bubble few decades in time where you could serve the world but only had to compete on an even footing against other labor situated in a high-cost area. This world-scale pre-post test of working remotely may be the discontinuity that aligns a global workforce to a global user base.
(Remote collaboration completely sidesteps the H1B issue, of course.)