I think the first term is by far the largest term in your equation. Source: the entirety of human history demonstrates that large groups of people need laws in order to function justly. In small groups, people are fine. But as you scale up, the likelyhood of bad actors reaches 1. Human societies need codified methods of dealing with bad actors, which is what a CoC does.
Additionally I'd argue that you think the denominator is largest because dramatic incidents are the most visible. The vast majority of big github projects have a CoC, if they really caused so many issues you'd have way more than "dozens" of examples.
Not having a CoC doesn't mean you don't address bad actors, resolve disputes, etc. It just means that these things are entrusted to the project leader's best judgment. And anyone can fork the project if they think the project leader isn't doing a good job of keeping things orderly.
It's a matter of scale. Humans have thousands of years of history codifying rules for communities. From Hammurabi to your HOA, people have found its easiest to enforce rules when you write them down.
(counterfactual number of problems without CoC - factual number of problems with CoC) / (factual number of problems caused by CoC)
The denominator is very large (I have personally seen this come up dozens of times, including this thread), and I suspect the numerator is very small (but obviously I cannot prove it, since there's a counterfactual in there).