Original birth certificate is what matters.
I thought the Supreme Court gave clarification to that in a very coherent and understandable way. Sex is biological sex (for the purposes of the Equality Act 2010), and biological sex means sex at birth, as recorded at birth.
Therefore one's original birth certificate, created by a registrar within the first six weeks of life, is the document that matters.