There generally has to be something in the middle (including for torrents/syncthing), or your 2 endpoints won't be able to find each other.
This could satisfy you or at least give you a starting point; https://gitlab.com/eneiluj/phonetrack-android
- available via f-droid
- not updated recently
This uses a server running nextcloud as the "middleman". But nextcloud is open sourced, so you can self-host it (I.e. run it on hardware you own, maybe in your home).
I can't vouch for the code quality, so it might only be a starting point.