a vm isn't connected directly to your internet so that is your problem
You are wrong, because bridged network adapters exist, but the problem is actually Microsoft do not allow Switch clients to connect to BDS and a VM hosted using a bridge network adapter does not allow Windows 10 to connect to it. THAT is the problem. Please educate yourself before you post something unhelpful.
Same here for my daughter: https://www.youtube.com/watch?v=04mfo1XM8qs
I also recently discovered that it requires a 3rd party workaround to fool the Minecraft Switch client into connecting to a Bedrock Dedicated Server. Honestly I am amazed by the poor design of this system and the blatant money-grab towards using realms...
Because that's an entirely valid and popular configuration for experienced administrators. It isolates resources to the VM, there are many, many reasons why someone would do this.