There will be certain cases - a lot of medical data, for example - where gender truly is important.
But in a lot of cases, you could reasonably have a person simply refuse to provide the information in the first place, or even just need a temporary value if gender is unknown at the time of record creation. A serious database has to anticipate those cases; this is not a big step.
And a database which needs gender for some legitimate medical purpose already needs to deal with special cases.
(And that's all without worrying about the question of whether those cases are lifestyle choices, genuine metabolic disorders, or something else entirely - the technology does not care about attitudes.)