Reinstall using existing data-dir and user names

I am planning on migrating my Nextcloud installation to a new VM and came across an issue while testing the installation.

By setting --data-dir to an existing nfs share and using the same username as the original installation, it failed with the following error:

Username is invalid because files already exist for this user

I think it may be related to this change: https://github.com/nextcloud/server/pull/18130

Is there a recommended procedure for using the existing data with the same usernames in the new install?

Full command used to install:

php occ maintenance:install --database mysql --database-name my_db_name \
    --database-user my_db_user --database-pass my_db_pass --admin-user admin_user \
    --admin-pass admin_pass --data-dir /path/to/nfs/share