Backup without user data

I have automated nextcloud upgrades that handle backing up the instance, performing the upgrade, checking that it was successful, and restoring from backup if something goes wrong. The backup includes the data directory as recommended, but I would prefer to exclude the user data as it should be persistent and not change between system upgrades (plus I have incremental backups to S3/Glacier for user data). For the system upgrades, I only want to backup the minimal amount to be able to restore in case something goes wrong. The data directory includes more than just user data so I’m hesitant to exclude the data directory entirely. Can anyone shed some light on what else is inside the data directory and how I could exclude user data from the backups?