Can you try booting into Safe Mode? You can do this by holding down shift whilst booting https://support.apple.com/guide/mac-help/start-up-your-mac-in-safe-mode-mh21245/mac#:~:text=Turn%20on%20or%20restart%20your,Boot%E2%80%9D%20in%20the%20menu%20bar.
Try to open up Recovery Mode (Cmd + R) and see if it happens there. If it does not, you might want to try reinstalling macOS
https://support.apple.com/guide/mac-help/use-macos-recovery-on-an-intel-based-mac-mchl338cf9a8/mac
Good luck fixing your MacBook Pro,
Ottobunny