I did a similar path (started from 18 iirc) and nothing broke.
But there's a catch, because I have some safeguards in place:
1. Nextcloud has its own dataset in a ZFS zpool. I take snapshots hourly, and I took a snapshot just before upgrading
2. I run nextcloud and its own postgreql via docker-compose. the docker-compose file along with the configuration and data are stored in nextcloud's own dataset. This means that os-level dependencies are not a problem for me. this also mean that reverting the whole thing to before-upgrade is very easy: just rollback to the before-update snapshot.
3. (unrelated) snapshot are replicated to another location, which means that I might perform the upgrade on that other site and switch the dns when it's done and if i'm satisfied. I don't do that, for my personal use 1-2 hours downtime it's okay.
4. I'll let nextcloud perform its auto-upgrade procedures, take a snapshot after every upgrade, and at the end I'll perform the tasks suggested in the self-assesment page (adding indexes, changing columns types etc).
You don't have a nextcloud problem, you have a system administration problem.