Those are called tariffs and other barriers, and in many sectors they work very well. I live in a country (South Korea) where such barriers have been enormously successful in keeping tech jobs and revenue inside the country. Literally everyone here has benefited from it, it's a huge win-win-win; consumers get human customer service, properly localized services and much less enshittification, politicians have a success to point at and get more tax revenue, the public gets jobs. Everyone gets sovereignty.
This also extends past tech. Forcing physical companies to set up a local subsidiary/do JVs has done the same. Examples abound, Starbucks being a big one. Forcing them to do a JV means a huge portion of the revenue of the biggest coffee chain in the country stays inside the country, as well as plenty of office jobs. Otherwise everything but the actual in-store jobs would have once again flowed to the US.
China of course has done the same, to similar success. Imagine if they hadn't, and just let e.g. Meta be their social media platform of choice, Google their search engine, Amazon their shopping platform. It'd be nothing but a massive net loss to everyone involved but those tech firms; including the Chinese public as the state would impose the exact same censorship and rules on those companies, as they currently do with the remaining ones.
That other countries haven't done so and just let SV walk over them in order to appease the US - who has now turned out not to be their friend after all, surprise surprise! - is very unfortunate.
This incredible imbalance is what has let the average HN FAANG employee make absolute bank at the cost of the rest of the world, so I'm not expecting this to be particularly popular here :)