Well, maybe.
Cloudflare is a company that sells to developers. A lot of developers hate patent trolls. Fighting back against a patent troll is a good way to gain respect and goodwill from those developers. So it could effectively be an advertisement campaign, and for the target audience, probably a lot more effective than paying for banner ads. It could also benefit recruiting, and moral of developers who like seeing someone stand up to patent trolls.
Also, by setting a precedent of fighting back, they might deter future attempts at shakedowns from other patent trolls.
That's not to say that their motives are completely selfish. I'm sure there were altruistic motivations as well (and motivations no doubt varies among individuals involved in this). But it isn't irrational.
For sure. I actually had the thought that I should consider applying to work there, exactly for the reasons you mention and one other reason as well: I enjoyed some of the snarky comments posted here which appear to be from folks at Cloudflare. They seem like people I would enjoy working with. So that's +1 to my opinion of the company in general and +2 to their desirability as a potential employer where I might consider working in the future.
If Cloudflare was to behave rationally, it would simply pay the troll to go away. Trolls are very good at making that the logical choice, which is why virtually everyone else just pays up. Cloudflare fights because the act of taking a stand fits with their values.
You're clearly not civic minded enough to appreciate why Cloudflare does what it does. And so you don't understand why other people, who share Cloudflare's values, would be motivated to help them accomplish their good deeds.