Can you name any countries that tax foreigners who work there without a work permit (or a visa that allows remote work)? Suppose I'm a US citizen working for a US company while I enjoy living in Thailand. I don't have a work permit in Thailand. Technically (according to Thai immigration and labor law) I am not allowed to work at all, so I'm breaking the law. In practical terms there's no way for the Thai authorities to enforce those laws unless I go around telling everyone I'm running a business or working for a foreign employer. If I try to pay taxes there without a work permit I am either going to get confused looks or deported.
The US is like this -- it's illegal to work in the US without a work permit or visa that allows work. If a French citizen comes to the US on a tourist visa and works for their employer remotely they are technically violating the conditions of their tourist visa, which prohibits any kind of work. Practically there's little to no enforcement for people working on laptops from coffee shops.
I'm not saying I don't believe you, I just haven't heard of any country requiring local taxes unless you have a work permit or some kind of visa that specifically allows you to work remotely. I can't see how those governments would enforce that unless they raided every coffee shop and hotel room looking for foreigners with laptops.
I know some countries have so-called digital nomad visas that allow working for a foreign employer remotely. I don't think that's what you're describing, though.