In all these examples it seems that there are perverse incentives, especially when we consider Goodhart's Law.
For starters: taking foreign travelers' phones or other devices away, temporarily or long term, creates a precedent for other countries to do the same. It is not a "rules for you, but not for me" situation. In that time period, we have no information if the device obtains malware or anything else. Thus the citizen returning home would inadvertently be "smuggling" contraband in the form of cyberweapons. It makes your own citizens more vulnerable to attack since it is much easier to hack a device when given physical access than when the attack has to happen remotely (which the government itself can play a role in since the literal entrances to networks require physical presence. Note that this does not necessitate decryption of data!) You cannot in good faith (or not) put pressure on other countries to not confiscate travelers' phones when you do the same. States that clearly don't have our own interests in mind. This is treacherous territory when you consider there are many states like China where we have contentious relationships with. Where we work with them closely, so foreign travel is not only expected but promoted (comes with an advantage of possible cultural imports, but that's meta), but at the same time there is an adversarial relationship.
When such a relationship exists between any two countries it would behoove the country to install malware on the foreign citizens' phone which can be exploited in numerous ways (both while that person is within the foreign country as well as when they return home). The only solution is to create a strong stance and precedence to prevent your own citizens' devices from ever having exclusive access by a foreign entity. This isn't just for high profile targets, this is for every citizen. We are well aware that mass manipulation works and that you can use ordinary citizens to gain increased sampling fidelity. More than one would be able to do with tools such as TikTok or Facebook.
Second: when looking at the smuggling of literal contraband such as child porn, illegal money (say idk cryptocurrencies), cyber weapons, or other such things, you have now incentivized going after the user rather than the creator. There are plenty of examples of this leading to poor solutions, with many examples of successful models. In the US the war on drugs did not go after the drug lords, dealers, distributors, and manufacturers, they predominantly went after users. The reason being is that these users are both far more common and significantly easier to pursue. When we use metrics such as number of arrests, persecutions, and so on to measure the effectiveness of our methods we align the pursuing agencies against the actual intent. The belief is that by going after users we decrease demand and side channel an attack to the upstream distributors but we literally saw an increase in alcohol usage during prohibition. Instead we can see how such metrics would actively incentivize such increases through the well known Cobra Effect. It isn't hard to find many cases where FBI agents have turned someone who was a little radical or mentally handicapped into an extremist, and then collect their bounty. Where these people would not have had the capacity to perform such an act without the help of federal agents. This isn't entrapment so much as heavy handed persuasion and is not hard to argue that the federal agent is instead the one performing that actions that are being stopped. The person being charged is a proxy or vehicle for such actions.
In classic style, Goodhart's law comes into effect because simplification of problems and a seeking of "good enough" is not necessarily aligned with the actual problem attempting to be solved. Many people forget that first order approximations often run inverse or orthogonal to the function they are approximating. Little do they question how quickly they diverge. Momentum also plays a heavy hand in these situations as we are resistant to change and exclusively operate on the belief that a system must be reconstructed from the group up (and thus stopped) rather than pushed back into alignment.
We have successfully seen models of decriminalization (distinct from legalization! Users can have contraband confiscated and still receive fines) work for drugs but this puts a significant pressure on agencies to shift focus to the true culprits of the material that is causing damage in the first place. When these work it is often because there are structures in the systems to incentivize actions that are more closely aligned with the actual intended goals. But these systems too may not work -- not just in the beginning where momentum is being overcome -- because environments change and the alignment can drift from the solution. An unwillingness to revisit and update policies is harmful in all cases. In essence, we have forgotten the clique "all models are wrong" and forget that metrics are models themselves.
"All laws are meant to be broken" because all laws are not perfectly aligned with the intent of the laws. We see any misalignment as failure in the entire system rather than edge cases or flaws that need to be updated or reiterated upon. But the environment is always evolving so if we don't have explicit mechanisms for continual updating as well as systems that perform quality assurance and account for edge cases (not just black swans) then any such system/policy is doomed. It is simply a matter of time. One needs to specifically account for that the "most optimal" route will be converged upon over time which maximizes the loss function of the policy. Maximizing the policy function is *VERY* different from maximizing the intent of a policy. The problem comes down to hyper-local (including temporal) optimization. If nuance isn't taken into account then ironically we waste far more energy pendulum swinging between solutions than were we to actually have considered the nuance in the first place. It is like waiting for things to break to fix them rather than perform regular maintenance. The latter uses far fewer resources and encourages iteration and re-alignment while the former often results in strong reactions that often result in large losses which are not able to be handled in that moment.
I often wonder if this hyper-focus on simplification is one of the great filters to intelligent creatures. Where a civilization becomes sufficiently advanced that nuanced principles dominate the challenges that such societies face, but due to the (likely) nature of the beings struggling to account for these nuances (evolutionary pressure is to approximate solutions and perform cheapest and most energy efficient computation at the scale of the individual and only within their lifetime) they are unable to solve them and worse, their solutions end up exacerbating such challenges. (Sorry, last part got very meta but I do think this is all connected because the mechanisms at play here are far larger than the specific topic being discussed.)