The way I solved it is by making a clean install, meaning I backed up all my data, reset the Mac to factory by starting the mac in recovery mode, wiping all the data on its ssd, and reinstalled macOS. Not only: when you factory reset your Mac it won't retain the OS you last installed, no, it will go back to what it had when it came out of the factory, in my case Monterey. So unless you bought your Mac in the last few months, chances are you're gonna have to install first the "default" macOS for your Mac, and then upgrade to the current OS. Finally, you can can put back all the files you backed up.
Double the hassle...