Hmm... Did you consider that "them"'s referrent might be unexpressed? Them refers not to cookie, but to "cookies", the plural form of the noun expressed in the sentence and whose existence is implied.

Not all pronouns belong to nouns that are expressed elsewhere in the sentence. "Are they going to help?" "They" is all by itself. Or try: "The man called and said that they would fix everything." "They" does not mean "man". It means some men/workers at the company.

I can also assure you that "cookie" here is not collective. If it read family: "I love this family so much that I hugged all of them". "All" quite obviously, and ridiculously, pretends to mean all families, not all members of this particular family.

I think some people here missed this, hiding in plain sight.

One more thing is that, a hundred years ago, is was perfectly common to just use the singular: "I like this cookie so much that I bought dozens of it..." Nowadays this sounds kind of stilted, but it's probably better English.


Your example sounds just fine to my ear, but if I replace the subject and verb in the sentence, I can create a less acceptable sentence, such as:

  • I like this teacher so much that I befriended dozens of them.

Or, even more absurd sounding:

  • I like Mike so much that I befriended dozens of them.

The absurdity owes to the pronoun-antecedent disagreement, and, in looking at these two examples, my rationale for the discordance is this:

The antecedent-pronoun disagreement is more pronounced in cases where there is a low degree of (or no) fungibility in the antecedent. That is, in cases where the antecedent is not interchangeable--there is only one Michael Jordan, therefore Michael Jordan is not fungible. Fungibility, then, is not a grammatical necessity, but an issue of euphony.

Here's another example with an entirely fungible antecedent:

  • This is the first dollar I ever made, and I've made a lot of them in my time.

Since the dollar holds no singular significance, it's very easy for us to see it as one or as many just like it.

However, when the antecedent becomes less fungible, when it draws up a more distinct person or thing, it can no longer be lumped in with others just like it without a stretch of the imagination. Here are some examples of antecedents and pronouns that become increasingly less fungible. See if you start to hear where the antecedent-pronoun discordance comes into play.

  • I like this Lamborghini so much that I bought dozens of them. (Most fungible, most acceptable.)
  • I like this Lamborghini Countache so much that I bought dozens of them. (Less fungible, still acceptable.
  • I like the 1985 Lamborghini Countach so much that I bought dozens of them. (Least fungible, starting to sound less acceptable but could possibly pass.)
  • I like Michael Jordan's 1985 Lamborghini Countach so much that I bought dozens of them. (not fungible, not acceptable).

I've been looking for something authoritative to support or negate your example sentence, but I haven't found anything yet. I'll update if I do. For now, I think your best bet is to run some sample pronoun-antecedents through whatever sentence structure you've got and see where the disagreement becomes too discordant to use. I suspect it will occur at that point where the fungibility goes away.