Consider also that foreign employee of foreign firms have long traveled for business (well pre-Covid they did) and there is typically no work permit required for short/medium stays. In most places it just requires a typical tourist visa or equivalent when under 3 months.
Maybe this will be much more common and laws would change, but it's hard to see why countries would resist such residents; they bring their own job, they spend foreign money locally and they're no strain on the local social welfare system. Economically, they're just as beneficial as tourists and not as much of a risk as the average immigrant.
My country has a tax-treaty with the country I do most of my work for, and so I only pay taxes in one not the other. Without such a treaty I'd have to pay taxes in both countries and it would make it unviable.
Anyway, among other things, he said that doing any work inside US borders, if not on a work visa, is technically illegal. Like apparently if I'm on vacation in the US, and I pull out my phone to answer a few work emails, that's technically a visa violation, not that in that case anyone's gonna mind. IANAL TINLA. And of course you're interesting in jurisdictions other than the US.
So, yeah, I think the way to find out is find a lawyer in the jurisdiction you'd be wanting to work from, one who advertises themselves as specializing in visa issues.
Will your firm catch you? Likely not if you are only working abroad for a few weeks, if you're doing it for longer, you'll probably get an email asking for clarification on your tax status (at best). At worst, they'll pull your VPN logs and demand that you get back to the states before you trigger some payroll issues.