Maybe we need an app that’s like this and does it for apps that are in the business of keeping the Mac awake https://objective-see.org/products/knockknock.html

But that would require the app to at least register somewhere in advance to be able to achieve that, if not a full fledged permission.