You're exploiting your own scope neglect bias: You know you'll regret what happened at that event, but you also kind of know that you'll regret it a similar amount, whether you eat that additional cookie or you whether you don't.
Moreover, eating that additional cookie lessens the weight assigned to the first transgression (e.g. the pizza), because now instead of a singular event it's merely one in a series of events, and thinking about the whole series, there's less individual regret based on that first pizza incident.
It comes down to trying to game your own reward/punishment system, acting as if that surrogate parameter is the actual goal (instead of the weight loss).
Puny hu-mans!
The "what-the-hell" effect, when you break a rule and then go on a rule-breaking rampage, like binge eating after a single dietary transgression, is a very common failure mode. It was recently mentioned in the Overcoming Bias blog comments on the Which biases matter most? Let’s prioritise the worst! post. I have not been able to find an explicit discussion of this issue here, though there are quite a few comments on binge-<something>.
From the Psyblog entry quoting this paper:
Although everyone was given the same slice of pizza; when it was served up, for some participants it was made to look larger by comparison.
This made some people think they'd eaten more than they really had; although in reality they'd all eaten exactly the same amount. It's a clever manipulation and it means we can just see the effect of thinking you've eaten too much rather than actually having eaten too much.
When the cookies were weighed it turned out that those who were on a diet and thought they'd blown their limit ate more of the cookies than those who weren't on a diet. In fact over 50% more! [Emphasis mine]
Other examples include sliding back into one's old drinking/smoking/surfing habit. For example, that's how I stopped using Pomodoro.
My (title) question is, what's the mechanism of this cognitive failure and whether it can be reduced to a combination of existing biases/fallacies? If the latter is true, can addressing one of the components counteract the what-the-hell effect? If so, how would one go about testing it?
For completeness, the top hit from Google scholar to the "what-the-hell effect" query is chapter 5 of Striving and Feeling: Interactions Among Goals, Affect, and Self-regulation, by Martin and Tesser.
EDIT: personal anecdotes are encouraged, they may help construct a more complete picture.