Change owner and group for specific owners only

You're not using -numeric-ids and/or -fake-super for your backups (and restores). If you modify your rsync command a little you'll get the mappings saved and restored correctly.

In these examples, the -M tells rsync to apply the next option, i.e. the fakery, on the remote side of the connection. An extra side effect is you don't need the remote side (where the backups are stored) to run as root

This pushes the backups from the client to the backups server

sudo rsync -azh -e 'ssh -pNNNN' --stats --delete --numeric-ids -M--fake-super --exclude-from="${exc_path}" "${src_path}" "${dst_addr}:${dst_path}"

This would pull backups from the client (i.e. restore)

sudo rsync -azh -e 'ssh -pNNNN' --stats --delete --numeric-ids -M--fake-super --exclude-from="${exc_path}" "${dst_addr}:${dst_path}" "${src_path}"

And this, run on the backups server, would push the backups to the client (i.e. restore)

sudo rsync -azh -e 'ssh -pNNNN' --stats --delete --numeric-ids --fake-super "${dst_path}" "${src_host}:${src_path}"

Each file stores its owner information individually, there's no data structure to index files based on their owners. So, whatever you do, you will have to hunt for the files, and change the UIDs on each of them, individually. Fortunately, that's not very hard to do; this should do:

find "$dir" -user olduser -exec chown newuser {} +

Of course, it would be better to change the backup system to store (and restore) the correct UIDs, especially if you might have backed up files belonging to multiple users.