lovefromisrael
Would additional profiles, in which you group apps that should be inactive at the same time, perhaps be a solution?
When you log out of a profile it makes the profiles inactive so none of the apps installed in them can run - when "allow running in background" is disabled.
Here some information from the
FAQ:
Using a secondary profile for regular usage allows you to make use of the device without decrypting the data in your regular usage profile. It also allows putting it at rest without rebooting the device.
and
GrapheneOS enables support for ending secondary user profile sessions after logging into them. It adds an end session button to the lockscreen and in the global action menu accessed by holding the power button. This fully purges the encryption keys and puts the profiles back at rest.
and from the feature overview:
GrapheneOS also enables support for logging out of user profiles without needing a device manager controlling the device to use this feature. Logging out makes profiles inactive so none of the apps installed in them can run.