I understand this completely, but the trick is to keep pushing and overcome the fear by practice. You WILL make mistakes.
Hell, I just discovered a vulnerability in a client's site the other day that I made 2.5 years ago. The vulnerability allowed a malicious user to upload a .PHP script via a custom Media Center. The logic in place was "if file is a valid image, upload to /uploads/images/, otherwise upload the file to /upload/pdf/". The problem is that it did NOT say "else if file is a valid PDF", so the script allowed ANY file to be uploaded to the PDF folder. That vulnerability was used on 4 separate occasions by a hacker in Morocco to use the client's site to host non-malicious files. It could have been really bad though. That vulnerability could have let the hacker destroy the site, steal account data, and much more. One could say I did not have ENOUGH fear when I coded that page. If I had been fearful of my code being bad, maybe I would've spent more time. Or maybe if the beta testers had been MORE fearful they would have tried uploading a PHP file. However, I probably coded it quickly and the testers most likely tested an image upload & tested a PDF upload and said "Ok it works!" without testing to see if the page would deny an invalid PHP file upload. This is a great example of how fear can actually be a GOOD thing for programmers.
People make mistakes all the time, so the important thing is to following these rules:
1) Double check your code (I most likely did, but missed the glaring vulnerability)
2) Test your code to make sure it works for the "intended use" (in my ex, test to make sure it works for PDF & image uploads)
3) Test your code to make sure it doesn't break or allow "unintended use" (we did NOT test the media center feature in this way, and that was our mistake)
4) Back up everything and as frequently as your server can handle (we have terabytes of storage space dedicated to backups, but we also host and actively develop over 100 websites)
Fear can be a good thing. Just don't let it eat you up - instead, convert that fear into motivation to produce good work. A fearless programmer will make more mistakes than the fearful programmer... but if the fearful programmer is too scared to create anything than the fearless programmer will come out ahead because they will make mistakes, learn from them and become more cautious while the fearful programmer stays in a place of fear. Anxiety & fear are great motivators to take actions that help you alleviate your concerns, but only if you actively attempt it.
Good luck 🙂