If you think this is just the US, you are mistaken.
Interesting. Do they ever find anything that's actually incriminating?
Had one trip to the US where they asked how much money I was carrying. I said none, just a credit card. They asked if I were planning to work there. I said no, I'll pull money from the debit card as I go. They (presumably) acted puzzled about this.
The general rule is "if you make money while in a country, you need a work visa while in that country", but obviously that may be a bit outdated and not take into account remote positions. Many countries can/will fine, blacklist, and deport you if they find out you worked while within the country without a work visa; and it's _those_ people that you need to be able to convince "I'm not taking your jobs away!" to.
I'm a US citizen so I haven't looked into it from your POV, but I do know that a trip to Canada, for example, allows working remotely as long as:
* you work for an American company with no Canadian offices or branches[1],
* you are paid in American dollars, and
* that payment is deposited into an American bank account.
Again, depends on the country you're visiting (and possibly the country you're a resident of), so I'd double check before working on a trip just to be safe.
[1] If your company has branches where you're going, the safest bet is to get them to help arrange the trip. A have a family member that travels a lot on business and has been denied entry to countries while on business trips specifically to train the local branch, because even then it's a delicate situation.
(Not sure why I get downvotes but no clear answers to simple yes/no questions.)