“ And a few weeks ago, that’s precisely what happened to a US citizen returning home from abroad.”
It’s not quite the same. Rubber hose (or $5 wrench) cryptoanalysis is torture. Sidd Bikkannavar was not tortured. He was pressured. This is something that happens in almost all routine traffic stops too. Law enforcement is trained to apply persuasion and pressure to obtain consent for searches and interrogation. When a policeman comes up to your car and asks “do you know why I stopped you?” Or offers a friendly “Good afternoon, where are y’all headed today?” Do you not realize that they are trying to develop (or at least leave the door open for) probable cause. They will leverage any opportunity to remain in control of that stop and obtain to consent to things that they cannot order you to do.
“It’s totally legal for a US Customs and Border Patrol officer to ask you to unlock your phone and hand it over to them.”
It would also be legal and common for cops to ask for your password inside the the U.S. To insistently ask. To sternly ask. To offer to end your brief detention more quickly if you “just cooperate” (even if that is a lie.)
It’s true that one solution is to not carry your phone. Another might be to forego international travel altogether. But presumably you do both these things because they are of value you to. If you want your rights first you have to know them, then you have to assert them — yes, even in the face pressure.