I am v. interested in solving this as well ! – I’ve noticed that even through the app appears in security&privacy, when you recompile it you have do permissions again. I haven’t dug into this deeply but some responses to this question mention code signing. will investigate:
A new annoyance, the only way I was able to resolve the screen recording permissions issue, was to follow Apple’s macOS Signing guidelines. I used my Apple ID for the developer account and team and Automatic Signing: