I've found an alternative after six years.
Searching around the internet brought me to this AUR package: https://aur.archlinux.org/packages/xcursor-transparent-theme/
From there, the package build leads to sources over at http://downloads.yoctoproject.org/releases/matchbox/utils/xcursor-transparent-theme-0.1.1.tar.gz . This contains a completely transparent set of xcursors. After installing these with
./configure; make; make install
For Ubuntu 22.04, you may need to link the resulting folder to /usr/share/icons/ with the following command
ln -s /usr/local/share/icons/xcursor-transparent /usr/share/icons/
The cursor became visible in my cursor theme selection in Gnome Tweaks.
From here, I can now change the cursor theme via the command line:
gsettings set org.gnome.desktop.interface cursor-theme xcursor-transparent
For reverting it, I can instead use Pop as the cursor theme, as I am on Pop OS. You'd likely use DMZ-White if you are on Ubuntu.
I used the keyboard shortcuts to bind Super+F10 and Super+F11 to set the cursor theme to either one, effectively toggling the cursor on and off when required. From here, you could probably find out a way to have these commands run whenever you focus/unfocus the window that you want your mouse to be (in)visible on.