Sounds like you want a feature like the Bluetooth and WiFi timeout but extended for Camera and Microphone access.
The recommended way of doing this is instead to just grant the app one-time access to the Camera or Microphone.
We recommend granting one-time access for user installed apps instead of ever granting allow while in use access to them. It's handled nicely by the permission system itself without needing the toggles. We don't currently plan on adding automatic disabling for camera/microphone/location since that handles it well and apps could keep these active by accessing them repeatedly so timeout wouldn't really work as intended. It could be bypassed any time it was ever actually particularly needed. Consider installing an app that runs a foreground service and continues using camera/microphone after you grant access. As long as it accesses frequently enough, it will never time out.