I personally just said to myself: fuck that, I'm writing good, I'm not going to belittle myself, and continued writing. As crude and unhelpful as it sounds, it really helped me.
I have five or so scenes in my story that in hindsight I think I could have done better, but I don't bother with it too much. I wrote them as I did, and I'm not going to change it, because I would be killing the first experience they were (no idea how to explain it better).
I think that doubting yourself is a sign that you're becoming self-conscious of the quality of your story and trying to improve it. My advice is: don't care too much. Don't overthink what bad things you can see in your story, but focus on writing it like you want it to be. If you notice you could have done it better, think what was the mistake, and don't make it next time, not scrap the scene and write it again. You'll just make another mistake if you try to fix it.
In my case, the worst case of self-doubt I had was when I was writing a turning point in my story that bordered on tragedy. I was putting it off for a really long while, trying to get inspiration or something and well aware it was an excuse, but I finally pushed myself to just write it, not make it good or show something. Afterwards I noticed it was pretty short and it would probably be better if I made it longer with more details. So I said to myself: nah, it's good, it shows how quick the events were from the mc's perspective. And I went on.
TLDR: Don't give a shit. Write, and improve along the way. Don't put it off, because that's an excuse (whatever it is this time).