I don't know if VMs are as good a solution as a RaspberryPi(-alike).
VMs are part of the 'important' machine, rather than being separate; using the same keyboard, mouse, monitor, etc. there's always the risk of e.g. typing into the wrong 'important' terminal by mistake.
Plus, a VM is like a "computer simulator" rather than a computer; introducing a guest OS certainly wouldn't prevent me wanting to play with the host OS, and I'd worry that keeping the host off-limits would allow "magical thinking" regarding how the machine operates.
It's also probably more empowering to be given a real, physical box too. Whilst the RaspberryPi is inexpensive it's still a real computer, running real software, which a child can own and make their own. VMs, like all virtual entities, can't be "owned" in the same way (e.g. see copyright).
VMs are part of the 'important' machine, rather than being separate; using the same keyboard, mouse, monitor, etc. there's always the risk of e.g. typing into the wrong 'important' terminal by mistake.
Plus, a VM is like a "computer simulator" rather than a computer; introducing a guest OS certainly wouldn't prevent me wanting to play with the host OS, and I'd worry that keeping the host off-limits would allow "magical thinking" regarding how the machine operates.
It's also probably more empowering to be given a real, physical box too. Whilst the RaspberryPi is inexpensive it's still a real computer, running real software, which a child can own and make their own. VMs, like all virtual entities, can't be "owned" in the same way (e.g. see copyright).