If you look at your DVD collection you probably purchased movies that you enjoyed watching. That would make sense because you want to have the luxury of replaying or sharing the great emotions it might stir.
Suppose you were to replay a movie you didn't care for? Perhaps one that frightened you, or one that evoked another unpleasant feeling. That might seem silly to you. Doesn't make much sense to torture yourself. Yet that is what you do when you choose to replay hurtful memories.
Think of your mind as a giant theatre. And you run the cinema. If you replay painful memories, you will evoke those feelings again. No one is suggesting you live in denial but you certainly don't have to keep running the same movie.
Much in the same way when you are creating new habits, and find yourself reacting the old habit. It might be useful to stop the film, and run it the way you want it to have happened instead. Replaying the old habit doesn't change anything. And it is reinforcing the old habit.
It's your theatre. What kind of movies are you choosing to play?