I don't get the analogy... Cloudflare is trying to protect websites from hacking attempts and similar, most of which is illegal. Their treatment of Tor also wasn't a deliberate decision but the result of empirical data they collected.
A government official (or anyone, actually) trying to check for compliance with the law isn't doing anything illegal.
Uber may be within their rights because companies usually have wide latitude to refuse doing business with someone, although that will ultimately depend on what kind of violations they were trying to hide, how invasive their stalking of customers was etc.
Morally, though, this is just more of the shady shit that's been coming out day after day. How any investor would be willing to trust them with their money is beyond me. Considering how intransparent their financials are, I wouldn't be surprised if this ends in an Enron-style meltdown.