I can only answer for myself. Confidence was never a factor for me. I never had confidence, nor lacked confidence. It was simply never a factor. It still isn't.
It's the old martial arts mantra. "If you care about winning the fight, you have already lost the fight."
Coonfidence, and lack of confidence, to me, both mean you're worried about things beyond your control. Agents, editors, publishers, the market, the reading public, are all outside things and outside events. They all happen outside the writer's door.
Writing happens inside the writer's door. If you simply write because writing is what you wish to do, and if you simply write the best way you can, and worry about nothng that happens outside the door, I don't think you need confidence.
When confidence becomes a factor, even seasoned pros can get in trouble. Fine, so the last book sold, and fine, it had pretty good sales numbers. But can I do it again? What if I'm a one shot wonder? Or what if I've lost it after all these years? Or what if the market has changed amd I'm too old a fogey to keep up? What if the reading public has outgrown me? I want to try a new kind of novel, I want to experiment, but what if I fail? Maybe I should just stick to the kind of novel I've done well with all these years? Maybe that's all I can write well? What if that reviewer was right. and I really am a hack?
I don't think it's confidence that keeps most writers going. Even seasoned pros, even bestselling writers, find themselves in serious trouble when they let confidence become a factor.
I think most writers who keep going, who keep trying, do so because confidence isn't a factor. They aren't worried about what happens outside the door because it isn't in their control. The focus everything on what happens inside the door. They're doing what it is they want to be doing. They're writing. They want to be published, they try to write well enough to get published, but that's out of their control.
It's a matter of write it, then submit it and forget it.