It’s a vicious cycle that can perpetuate itself for years in every situation that you have doubts, confusion or regrets about.
The only way to overcome it is to consciously stop yourself and to accept that you’re human, meant to make mistakes and move forward. You can’t move forward if you’re looking backwards.