I had this issue also a while now. It's been extremely frustrating.
However System Settings > Privacy & Security > Developer Tools and check Xcode is added and toggled on fixed it for me. At least I haven't had any issues yet after doing those settings. It should be commuinicated more promient. Even Claude AI didn't suggest that as a solution.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: