Given that the only way to likely avoid this issue of needing to be unlocked is to disable all security on the device, which would also mean that none of your wallet apps and most if not all of your banking apps will no longer work, it may be more beneficial to solve the restarting issue.
You say that it seems to only happen when WhatsApp is open, what have you tried to solve that issue?
First let's do some maintenance on your WhatsApp app. Check and ensure it is not in your sleeping apps lists. Apps being put to sleep can cause issues, especially if it is an app that usually requires exclusion form power saving. Go to Battery and device care>Battery>Background usage limits>Sleeping apps/Deep sleeping apps, and remove WhatsApp if it is found in either of those lists. If you find it in one or the other of those lists you may consider adding it to the Never sleeping apps list.
As for the app itself clear the app's cache and maybe even its data or uninstalling it and reinstalling the app. Clear the cache even if you uninstall the app because I've known apps to reinstall and go right back to a bad condition because items were not properly cleared out from the uninstall alone. Go to Settings>Apps>WhatsApp>Storage>Clear cache/Clear Data. By clearing the cache you should loose nothing but by clearing the data you will likely have to log back in and, I'm sorry but I'm not that familiar with WhatsApp but, you may also lose your unsaved messages, so back up message threads that are important to you. Obviously with reinstalling the app you will lose items but again these can likely be backed up before hand.
Finally just for good measure, clear your device's partition cache. There really is no reason not to. Just like with any other cache clear there should be no data lose. After whatever you deem to be your last step in the process, restart the device and let us know the results after a day or two. Is it still restarting and any of that? We can go from there.