If we look at the NHS data dictionary for "phenotypic sex" it looks like the only places it is mutable is as a result of maternity events. www.datadictionary.nhs.uk/data_element...

PERSON PHENOTYPIC SEXA classification of PERSON PHENOTYPIC SEX.www.datadictionary.nhs.uk