In case you're still looking to do this - can I confirm the need?
Could you also please confirm if you have any JQL extension Apps, like Scriptrunner? And/or if you have Automation for Jira?
To do this, you either need...
Option (2) requires an App, but Option (1) might be possible using:
The rule might work something like this:
And then some method to remove it again, if all children are removed.
This metadata is then on an Initiative level, and could be referred to in JQL!
Do you think this is workable in your instance?
Unfortunately there isn't.
The other alternative aside from Automation is to use an App which extends the functionality of JQL, like Scriptrunner - if you have an App like this, it will likely be possible to get these results.