If they settled the trolls would just keep coming.
If they fight the patent extortion then trolls are going to think twice before suing them, for fear of losing .
They were also getting sued regularly, by patent trolls.
They had really good lawyers, and had a basic policy, to never settle with trolls. It wasn't altruistic. They just didn't want to get bullied. I'm sure that they also went after other companies, and there was probably a lot of wheeling and dealing. That's one of the reasons that corporations like to hoard patents.
They used to require their engineers to file a couple of patents a year. I am on a patent. I got a dollar for it.
It's likely that over the lifetime of the patent, the total cost would have been more than the cost to fight it, and as the a sibling pointed out, settling begets more suits + settlements. It adds up fast.
This isn't Cloudflare being "good," it's in their best interest to fight frivolous suits.