If your thoughts were elsewhere then perhaps you did do the right thing. It is easy to focus on what you
don't have, but harder to appreciate the things you have right in front of you. When you were with her, you obviously had doubts as to whether the relationship fulfilled you; and now that you don't have her, you can look back and think 'yeah, it actually
was pretty good, maybe we should go back'. If you
did get her back, you would probably go back to the old doubts again and the cycle would repeat itself.
The problem here appears to be a relationship possession syndrome

You seem to focus more on the personal pleasure and satisfaction of your relationship (ie: the fun that the relationship can bring for you individually) rather than on the reciprocal partnership of patience, support and love that a healthy relationship entails. I can relate, I tend to get absorbed in myself as well man.
You just have to let this go. Be strong, and move on. Focus on the things that are
in your life now, not the things you wish you had.