Don't let anyone talk down to you, starting with you.
Monday was my first day in a new job, my first role with a title prefixed with "Senior". My immediate instinct upon seeing my new email signature was to query with the line manager if there had been some kind of mistake. Imposter syndrome is a daily reality. Accept that it will happen, and work to build healthy self-awareness and coping mechanisms within yourself.
I am certainly not advocating that women are their own worst enemy, that gender disparity in tech is because women 'just aren't confident enough', or other bullshit excuses. The root issues are absolutely external to you. You are not the problem.
But, my own experiences tell me that after every setback and negative experience, I carried an echo of it with me in my brain, which at times has threatened to poison newer and healthier working environments with self-doubt. You won't be able to fix an entrenched toxic workplace alone (don't ruin your health trying -- quit, find a better place), but in a supportive professional environment you can work to mitigate and silence the outdated, internal voice telling you that you're not good enough.
I'm saying this because it's important to be able to go home at the end of your working day and feel good about yourself and proud of your own achievements. All of the positive working environments in the world can't make you feel good about yourself. If you can achieve a feeling of satisfaction and contentedness from your own efforts, you are that much stronger.