We are also in hard place at the moment because macos now also requires a stapled notarization. There are open source tools for it that seem to work well, but they introduce a big rat tail of dependencies.
You send your binary to Apple and they do some checks before signing it. That’s what “Apple checked this application and found no malware” prompt is.
Also, those signatures can be revoked or even blacklisted if required.