Rules like the US Constitution's 4th amendment, and laws like the GDPR (and to some extent, CCPA/CPRA) aim to do that, but neither goes anywhere near far enough. 4A often gets interpreted narrowly by US courts, to the benefit of law enforcement. And the GDPR enforcement mechanisms are far too clunky and -- at least from what I've seen so far -- don't work particularly well. Not to mention that, for it to be truly effective globally, the US would need a federal-level law to match it.
Encryption alone doesn't matter. If your social and political climate is not oriented toward privacy, your privacy tools can simply be made illegal.