I just had this 'debate' with someone elsewhere online. After they spouted the usual wokeness about whoever says they're a woman literally being one, we got onto this topic and I asked what information the midwife uses to 'assign' the child as boy or girl, if it's not just about observing their sex.
'They see its gender', I was told.
Of course I asked how anyone could possibly do this, as by trans-ideology gender is internal and ineffable and non-binary and so on. Observing sex would be so much easier. I was told in the next comment that I should be nice and not hurt trans people's feelings, because 'feelings matter more than facts' (seriously, that isn't a humorous paraphrase) after which the person sharing this wonderful wisdom deleted all of their comments.
Oh well. Lesson learnt. Archive everything.