I understood it as "do the bad habit, regret it, do a new good habit right afterwards." The aim is to rob the bad habit of whatever reward is attached to it and mentally transfer the reward to the good habit instead.
It will continue to encourage subconsciously that bad habits are o.k. if I do something else to compensate it.
For a simple example, I eat a lot of sugar and then do a 10minute exercise. Then feel good about it that my sugar eating is fine, as I will exercise afterwards anyways. But the exercise is separated from any rewards or motivation and will likely often get skipped when my willpower is low(time when bad habits set their claws on mind).