It comes down to how you define 'working from a country'. Doesn't it mean 'being employed by a local company and paying income taxes' there?
If I go on a vacation and respond to a few work-related emails, am I breaking any laws because I'm working on a tourist visa? Yes, that is ad absurdum, but I'm trying to point out that it's not as clear cut. There is a line that international treaties define, and staying someplace (sometimes even up to 6 months) and working there doesn't necessarily have any income tax implications for you or your employer.