To a certain extent, I do this too. I find it helpful to ask what I gain from going back to my old ways. In my case, I wanted to go back to drinking because it numbed my feelings. So from there, I figured out that my real problem is I want an easy way to not feel pain. I can find a solution for that that doesn't make me revert to old ways.
Do you think you lack willpower or self control? If you look online there are YouTube videos and articles that help people gain better willpower. I think what aids a person in changing is being kind of stubborn and sticking to it.
I want to remind you that it does take time to change as well. Many, many people fall off the wagon and go to square one. You're not alone in this. If you have setbacks, that doesn't mean you never made progress. Just seeing your issues and knowing you need to change is progress by itself.