The Nextcloud app kind of does it, it seems. The fact that it stops working seems unrelated: starting the app doesn't make it recover, so it just seems buggy.
Nextcloud uses the location permission for some reason, presumably to wake up the app in the background once in a while? At least it can be closed (and "swiped away") for 2 months and keep syncing. Until it breaks and stops working entirely.
I really would like something like this.