If your gonads are ambiguous, then you might get assigned a gender at birth based on what they look most like, or what your parents want, sometimes with corrective surgery.
I suspect they still don't do genetic testing for intersex to inform such a decision.
So your assignment at birth can be very much arbitrary.
Indeed, this is why I feel that assigned gender is a very hostile construct which is imposed upon people. People (usually righties, but it seems everyone is guilty of this argument) claim "iT's jUst aN oBseRvAtioN" when it's actually quite arbitrary, since they can just choose for intersex people (and often choose wrong) what's worse is that for intersex people who do have id done wrong to them people will say "it wasn't wrong, you're just trans (a minimization argument I hear a lot which is really gross, demeaning, and invalidating) which stings even harder when it's from members of the LGBTQIA who are supposed to be supportive, I had a friend who went through this and everyone insisted he was a trans man, even though he knew from his medical records.