You can try running Disk Utility First Aid on the hidden Container. Within Disk Utility you may need to click "View" and select "Show All Devices" before the hidden Container appears on the left pane of Disk Utility. Even if First Aid says everything is "Ok", click "Show Details" and scroll back through the report to see if any unfixed errors are listed. If any unfixed errors are listed, then try running First Aid from Internet Recovery Mode (Command + Option + R), otherwise you will need to erase the whole physical drive before reinstalling macOS & restoring from a backup.
You can try creating another admin user account. Log out of your main user account, then log into the new admin user account. See if you have the same issue on shutdown from this account as you do from the main account. If the new account does not have the problem, then you know the issue is contained to the main user account. Maybe manually quit each app making sure each app does fully stop running before selecting "Shutdown". I would also uncheck the "Reopen windows on login" found on the shutdown/restart pop-up confirmation window to see if that makes any difference.
You can try reinstalling macOS over top of itself to see if it may fix the shutdown issue which would keep everything intact. It is a bit less disruptive than erasing, reinstalling, and restoring, but it may also be less effective depending on the issue.
If you are going to perform a clean install, instead of manually erasing the drive you can also "Restore" the firmware instead which resets the T2 security chip and pushes a clean OS onto the internal SSD with the latest version of macOS, but this option requires access to another Mac running macOS 10.15+.
Revive or restore an Intel-based Mac using Apple Configurator - Apple Support
Sometimes wiping everything and restoring may be the quickest solution assuming the backup doesn't contain the same issue since it can be difficult troubleshooting things.