Joel didn't doom humanity. There was no guarantee that sacrificing Ellie would have lead to a cure.
If it were a sure thing, or even close to it, then I would say he should have let her go. But, who would let a loved one die on the off chance that her death might lead to a cure? Probably next to nobody.