The intuitive fix is to feel worse about the slip so it does not happen again. The evidence points the other way.
Adams and Leary tested this directly in 2007 in the Journal of Social and Clinical Psychology. College women were given an unhealthy food preload, a doughnut, and then an ostensible taste test with candy, which measured how much they ate afterwards. Half received a short prompt encouraging them to think about the doughnut self-compassionately rather than as a failure.
Among participants high in restrictive eating, the self-compassion prompt reduced the disinhibited eating that normally follows breaking a dietary rule. They ate less, not more, after being told not to beat themselves up. The result was not uniform: participants high in eating guilt did not benefit as much, which the authors attributed to the difficulty of shifting deeply rooted guilt in one short session.
The proposed mechanism is the useful part. Self-criticism after a perceived violation consumes self-regulatory resources. The distress is not free. You are spending the exact capacity you need for the next decision on processing the last one, which is why the second lapse follows the first so quickly.