Is there a special reason for php 8 or is it crucial in any way?
Otherwise just install nextcloudpi on your new system an restore your backup as described here:
Nextcloudpi is running on Debian 11, Nextcloud 24 (I’m curious why you haven’t updated yet) and php 7.4
Furthermore you keep your administration and security tools you are used from your system now.