The issue is here and is usually with this sort of topic is it's confusing two things:
Gender - sexual orientation
Sex - biological
On your birth certificate you do not put gender as that would make no sense. It uses the words Male and Female based on the biological evidence of if the child has male reproductive organs, female productive organs, both or none.
Having undecided as Sex (or written as gender sometimes which is where the confusion comes in) makes genuinely no sense on a birth certificate. For instance someone may grow up and discover that they like the same sex, or they want to transition to the other sex, but that still doesn't change that biologically when they were born they had a certain sex.