Self-doubt is a writer's constant companion. But, it's better if you look at it benignly, rather than with loathing. It's proof that you want to do a good job, not that you haven't!
At some point, a writer has to get on their own side. The way I see it, is that everyone is a critic (especially in the internet age where anonymity rules), so why join the naysayers?
In the publishing process your book will meet these people: editorial assistants or freelance paid readers or work-experience interns who trawl through the slush pile, before a proper literary agent has a look, followed by underlings and decision-makers at a publisher who'll pass your story on to editors, then book cover artists and publicists. Printed, your book will be mulled over by critics (or totally ignored), accepted or rejected by book distributors and bookshops, then fingered by readers who'll post their own reviews online. Eventually, it might end up on a charity shop shelf, where it's offered as part of a buy-two-get-one-free £1 offer. From the moment it's in physical book form, it faces being pulped.
With all of that lot potentially against your story, it needs a protector—you!
Self-doubt afflicted even great writers, such as Charles Dickens who couldn't leave A Christmas Carol
alone, constantly tinkering with it:
Charles Dickens Couldn't Stop Tinkering With 'A Christmas Carol'
I have a Persian ancestor, my Great-great-grandmother, who was of the Parsee
people, a Zoroastrian community who were chased out of Persia in the Muslim conquest of the 7th-century, to settle mainly in India; the most famous Parsee was Freddie Mercury. I recall a painting of this lady on the wall of my grandmother's spare bedroom, alongside a framed Persian proverb:
He who knows not, and knows not that he knows not, is a fool...shun him.
He who knows not, and knows that he knows not, is willing...teach him.
He who knows, and knows not that he knows, is asleep...awaken him.
He who knows, and knows that he knows, is wise...follow him
I remembered that proverb and it's helped me navigate through life; just because someone is rich or in charge, doesn't mean they know what they're saying or doing. Now, that I'm a writer, I'm confident enough to believe in the last line about myself. The second line is my current state of thinking about querying and self-publishing.
At the moment, I'm dancing with doubt, trying to decide which way to go with my writing career. Fortunately, I have less self-doubt than I do suspicion and qualms about Amazon, blogging and the value of posting on social media to publicise myself and my novels.
So it goes, for in planning a route to take there are no accurate maps. I feel more like I'm surrounded by fog with a wonky compass, while invisible writing gurus shout advice to me, many of them wanting to sell me their guaranteed directions.
I'll find my own way. As Charles Bukowski
The problem is that bad writers tend to have the self-confidence, while the good ones tend to have self-doubt.