The main thing I've tried was opening VirtualBox and using
File -> Preferences -> Proxy -> Manual Proxy Configuration
to set my host to 10.8.0.1 and its port to 1080, since this is the info for Mullvad's SOCKS5 proxy. This didn't work as when I opened a VM with my VPN connection active and disconnected it, I could still access the internet through my VM.
I'd like to force my VMs to only be able to use the internet when my VPN connection is active, so that there is no chance of leakage. I do this with qbittorrent by forcing all traffic through tun0 within the app itself, but I haven't been able to figure out how to do anything similar with Virtualbox.