They aren't murdering everyone whos phone / laptop they check at a border. It would be perfectly fine to have an encrypted disk drive that presented different contents based on what password was used to unlock for instance.
And with something fully arbitrarily scriptable like this, it doesn't have to simply wipe stuff, it can do practically anything. It could fake having a dead battery, or suffering some kind of crash or other normal annoying service interruption. It could fake a Microsoft account login problem due to some problem with the wifi or borked corporate account control etc. You could increase the believability by pretending to have very common bad security habits like having the duress password written down somewhere on your person or with the machine.
If you are a spy and they have you in a hole, then your cover is already blown. They will remove and dissect the storage without even trying to boot it. But things like this could keep you from being noticed in the first place, and could sufficiently handle the vast majority of situations.
In Russia right now, they are stopping random people on the street to look for certain telegram groups on people's phones. The randos aren't spies and aren't specifically targeted. The police are really only doing it to scare everyone else away from accepting any communication about Ukraine from outsiders.
It would be exactly perfectly good enough if they simply didn't see what they were looking for.