WhatsApp can do a local backup to /storage/emulated/0/Android/media/com.whatsapp
I have that set up, and Nextcloud syncs the folder to my server
Yes, but WhatsApp is very finiky about restoring that backup when you're setting up a new device.
Due to this, I've resorted to backing up to drive without any media and then after restore, sync the media back via other means.
It's also worth mentioning that when you sync with drive, it doesn't preserve the time stamps of devices
While this will backup all the media files, the chats themselves are encrypted and the key to decrypt them is not included with that backup. The key is in the data partition which you will not be able to access without rooting your phone.