"I could have done better."
It goes on and on in your head and takes all your bandwidth (without your consent, by the way).
Of course, you could have. You can always do better.
Instead of dwelling on that thought, try it instead:
1. What could I have done better?
2. List all the points
3. Choose one and start working on it
4. If you have the opportunity (we always have the opportunity), try again and focus on the point to improve.
You will probably come to the same conclusion.
"I could have done better," but now, instead of complaining, you have (an intention) and a process of continuous improvement.
The fun is in the process. Reward yourself every time you do it.