What detects it is running on windows out of interest?

I use WSL extensively, with lots of languages, and I’ve never had anything do that.

It’s running in a VM, so that would be some kind of weird VM escape?

It's easy, it's right there in uname -r.