Need to solve “Can’t be opened because it is from an unidentified developer" by any other way than changes the Security and Privacy settings
The issue is that using a self-signed certificate does makes you a « identified developer » (at least to the eyes of macOS)

The system only accounts for certificates which have an Apple CA as their root.

If you want to get rid of the pop-up, ask for a Certificate on Apple’s Developer Console and sign your app with it.

Another way is to use csrutil to completly bypass macOS’ security mechanisms, but I highly discourage you from doing this, nor telling your end-users to do so...



Bypassing the security of an OS with a self-signed certificate would make the system... well, unsecure !

By using their CA in the certificates they issue through their Developer Program, they can revoke any app (or developer) at any time, allowing them to ensure the system security when someone tries to do bad stuff.