It’s a simple equation, but not necessarily an easy one. You do your best work in any given situation—except when you exceed your expectations, or utterly fail to meet them.
What matters is that you dig dee enough to lose yourself in the creating. Flow will take care of both uncertainty and evaluating the past work. If you try to make something “great,” or similar superlatives, it’s a distraction. What you’re aiming for is to melt away judgment and doubt. That happens when you have a habit of falling into a piece and finding its soul, for lack of a more real term.
This takes time and practice. But it’s a common and easily understood phenomenon for creators of all types. You know when you’ve reached the point when you’re on the other side of it.