They do, actually.
It’s for collecting taxes, which supports local infrastructure.
Going to another country, living within their infrastructure and consuming their services, but pretending that you’re not working (and therefore not paying local taxes) is something they don’t want.
Digital nomads who abuse the situation like it because they get the benefits of a country (and city, region, etc) without having to contribute to their taxes. Getting California level pay, not paying taxes, and living in what’s basically a vacation destination is the digital nomad dream.