settings > device care > battery > background usage limits > put unused apps to sleep........ toggle off
While this supposedly works to stop ALL apps from being put to sleep. I have found that for some critical apps, they still seem to disappear from time to time (I have one in particular that I use for presence detection at my house - Hubitat). So, for critical apps, I do several things:
1 - The steps mentioned above.
2- In the same Background Usage Limits settings page, I click on "Never Auto Sleeping Apps" and add the app to that list. (NOTE: if you have done step 5 already, this option will not be available)
3 - Back up one menu from above and turn off the toggle for "Power Saving"
4 - Settings -> Device Care -> Memory -> Excluded Apps -> "+" and add the app to that list.
5 - Long press on the icon for the app in question and click the "i" (OR Settings -> Apps -> YourAppName) scroll to battery and click Unrestricted (NOTE: If you do this before step 2, the app will be unavailable to put in "Never Auto Sleeping Apps" category)
Lastly, the only way I know of to not remove permission if not used is to toggle that switch for each app you want to have the system leave alone. I am not aware of any global way to set this.
Long press on the icon for the app in question and click the "i" (OR Settings -> Apps -> YourAppName) Toggle Off the "Remove permissions if app is unused"
Also note - You may have to do this all after each update. I have had all of the above revert to default values after some updates
One more thing if you do have an app that is absolutely critical to have running all the time, you can also:
Open the app
Click the Home button or go to the home screen (without closing the app)
Click the Recents
Find the app in the recents and tap the icon in the upper part of the app
On the pop up menu, click keep open.
This will leave the app always running in the background. It usually survives reboots. However, I would double check each time as it does seem to close occasionally after a reboot or two.

