I understand what you mean only too well. The more you want it to be perfect, the more likely it is that something will go wrong. It's a slightly different version of stage fright. Over time, I have reached the point at which I don't worry so much when playing in front of others. As a result of less worry, I make fewer mistakes, resulting in even less worry. It's a virtuous circle. With recording, I have not reached that stage yet, its circle is still vicious. I make more mistakes. I worry more. But I've only been playing around with a recorder for a couple of months. Still a way to go before I dare submit my first recordings here!
I'm still more or less a complete beginner, so a lot of my struggles are not problems with technique or musicality, but nerves. I botch lessons with my teacher sometimes just because I'm nervous. I've come up with a few little techniques that help me a lot with the mental aspect of playing, and I would definitely recommend giving them a try.
First, before even warming up with a few scales and arpeggios, I do light stretches for 5-10 minutes. The idea is to get completely at ease and remove all tension from your body. It helps me prepare mentally to play if my body is loose and relaxed. Also, stretching is just good for you, period, if you do it correctly
The next thing is to know when to take a break or stop for the day. While it's tempting to keep forcing yourself to keep trying to perfect this one passage or eliminate all mistakes, your playing can spin out of control if you get too frustrated. When this happens, I step away from the piano, get some ice water/iced tea, do a few more stretches if I'm feeling really tense again, and take deep, calm breaths. Only when I'm calm do I consider going back to the piano.
Hope this helps, and good luck with future recordings