We have at least two goals when we punish: to prevent the commission of antisocial acts (by deterrence or incapacitation) and to express our anger at the breach of social norms. On what basis should we decide that the first type of goal takes priority over the second type, when the two conflict? You seem to assume that we are somehow mistaken when we punish more or less than deterrence requires; perhaps the better conclusion is that our desire to punish is more driven by retributive goals than it is by utilitarian ones, as Sunstein et al. suggest.
In other words, if two of our terminal values are conflicting, it is hard to see a principled basis for choosing which one to modify in order to reduce the conflict.
Cass Sunstein, David Schkade, and Daniel Kahneman, in a 1999 paper named Do People Want Optimal Deterrence, write:
If we're after optimal deterrence, we should punish potentially harmful actions more if they're hard to detect, or else the expected disutility of the punishment is too small. But apparently this does not accord with people's sense of justice.
Does this mean we should change our sense of justice? And should we apply optimal deterrence theory to informal social rewards and punishments, such as by getting angrier at antisocial behaviors that we learned of by (what the wrongdoer thought was) a freak coincidence?