Obsidian Sync has saved me a few times too. The only thing it lacks for my usage is an API. I just want a clean way to backup my notes to my own storage.
Yeah I tend to use Obsidian on mobile alot so I was thinking of just running a minimal linux VM with just X windows installed on my homelab and utilising a script like the one you posted.