Even if the phone was on, unencrypted, and locked it would fail.
Edit: I initially misunderstood where you were coming from. Yes, today things are more secure, but if someone has unfettered physical access to your device they can just as easily install hardware that waits for you to login and then do these things or replace your charger plug (on a mobile device) or use a modified Bluetooth or USB proxy to keylog (on a full device). We're of course getting into high-level corporate attacks at that point if to be unnoticed (i.e. no popups, prompts, unexpected changes), so the average user is much more safe.
At some point, if you have physical access and the device pin, you should assume it’s game over, but there may also be a point in time where we no longer care about physical security as much, if at all.
https://amp.cnn.com/cnn/2019/01/09/americas/el-chapo-it-tech...