The fact that these visas are becoming available means that governments are wising up to the fact that people have been working remotely on tourist visas and want in on it. They want to be able to charge for it, or set a limit on who can do it, or tax it.
Now that these visas exist, and immigration officers know that, it’s only obvious that they’ll start to ask ‘tourists’ if they plan on working remotely or not. You can lie all you want, but if they find evidence (two laptops, notebooks, equipment) then good luck.
What happened in the past is just that.
If they disliked the idea they wouldn't be creating new visas for the purpose, since that only makes it more prevalent and normalized.
If you are a tourist who works for a foreign company while visiting a country, well I don't know a single person who has been actually deported for this. I know it can happen, but most places seem to not care much, and mostly care you're spending your money in their country.
I am a digital nomad myself for about 1/2 every year so I do have my biases though.
I think a big part of this is that it's basically impossible to find digital nomads. How would a country know if you're in a hotel room or coffee shop working on your laptop? If you don't tell anyone what you're doing, they aren't going to know.
Digital nomads also don't trigger the same "taking a job that a local could have" fear that drives a lot of immigration policies. As you note, you're just a person in that country spending money. However, you're also probably not paying taxes. I think there's a bit of a tension there. On the one hand, you're bringing in foreign money. On the other hand, you're using services just as a resident would and not paying all the taxes (you are likely paying some taxes like sales/VAT).
Ultimately, I think a big part is that countries haven't figured out what to think of digital nomads. Heck, companies haven't figured out how to feel about them. Companies still haven't settled on whether remote workers should be paid less if they move to a cheaper location.
Many many people are doing this already.
There are legal gotchas and grey areas. I would guess the Japan visa is aimed at clarifying the matter for long stays, because there's certainly no shortage of digital nomads in Japan.
You can get away with a lot by being sneaky, but the companies are strongly officially opposed to it.
The fact that many companies are risk-averse and don't allow it doesn't mean it's not legal. Like I said, at least one FAANG (maybe more) is fine with its employees working remote internationally if they follow the rules.
Nobody gives a shit, as long as you're not staying long enough to be a tax resident and you're not making trouble.
The one famous incident, the 2014 Chiang Mai raid, came about because the authorities didn't know what a co-working space is, and thought that the foreigners were hired by the property owner to work there. None of them were deported for that.