in any case I think there are plenty of apps that do this. Some are distributed as packages instead of apps.
I'm not a Mac dev expert at all but I have used enough apps to know it's possible. Many of those apps are open source maybe look into them if you want to solve this issue.
Electron apps have tools for automatically signing on GitHub actions so looking though what they do might help?
sorry I don't have concrete suggestions. I'm just confident there are solutions.
I'm totally sympathetic to the fact they it's a pain in the ass and Apple, probably intentionally, doesn't document the process well or at all