There is nothing unreasonable or illogical about believing that it is okay for companies to break some laws but not others. You can come to that conclusion in at least two perfectly reasonable ways: you can believe that breaking laws is not in itself a bad thing (but that actions that break some law may be bad for some other reason, such as harming people), or that it is a bad thing but in some cases the lesser of two evils.
However, in practice it may be difficult for a company to organize such disobedience, particularly since, for example, Facebook cannot avoid hiring employees from religious groups who are in favor of these laws. So, a more practical approach is to avoid being in the position of surveilling people's private communications in the first place, so that no employees at the company have access to the information the police seek. End-to-end encryption is a crucial structural protection against this kind of pervasive surveillance, because it prevents intermediaries from having the private information in the first place. Pseudonymity is another one: the teenager should never have given Facebook her legal name, but unfortunately Facebook has extensive policies in place to extort legal names from its users, making them vulnerable to such abuses.
Of course talking about encryption always brings out the knuckledraggers who link to XKCD 538 and talk about hitting people with $5 wrenches. Hopefully this example clarifies why encryption sometimes defeats a $5 wrench: neither the Nebraska teenager nor the Facebook employees were ever at risk of being beaten with a wrench in this case.