Google just cannot get the hang of this smartphone thing. Its Pixel phones have always had lesser or greater issues, and new Pixel 3a and 3a XL are no exceptions. This time the problem is random shutdowns. They occur when the device is not actively used; afterwards, their screens cannot be turned on, and the devices need to go through a hard reset in order to be usable again.
The reason for this cannot be any third-party app, since shutdowns happen even in Safe Mode. Another theory is that the turnoffs are caused by home network wi-fi, but it requires further proof. No official nor unofficial fix is currently known.