I belive Estonia is at the forefront of this:
https://e-estonia.com/e-residents/about/
> On the other hand, isn't a lot of the remote working in Thailand also "technically" illegal?
Technically? Yes. You'll hear a lot about visa runs where you hop over the border for an hour or two, and then come back to Thailand for another 6 months. My guess is that you're following the spirit of the law, as Thailand hasn't really thought out how they want remote workers to be handled locally, but they're enjoying the economic benefits of them being there.