Changing hostname

It’s a good bet that if you install the current version on the testing server and restore the database to it that you can upgrade the production server.

What you’re proposing is likely several hours of work, has a bunch of confusing little bits that will be very hard to describe in a forum, and isn’t going to prove anything that restoring the production database to the new server isn’t going to do.

Just point the staging server and the production server to the same S3 backup bucket, backup production and restore it to the staging server. Going forward, they’ll be in parity and you can upgrade staging and production in rapid succession.