I struggle with this. My reaction to being challenged, even before finding myself in a leadership role, is always the knee jerk that you describe. After some reflection, often quite quickly once I can stop and think about the matter, I revert to your other scenario.
I've been trying to get myself to a place where even if I'm reacting in a knee jerk fashion that at least I'm keeping it to myself but man, it's hard to overcome something that's effectively instinctual.