ID documents have three components:
1. Authenticating the issuer, eg with hard-to-do stuff like holograms
2. Authenticating the owner with biometric data
3. Authorizing the owner, ie, proving name, age, address.
Where does gender fit into this picture? If it's proving who owns the ID, a photo does a better job and disallowing change discriminates against trans people by making their IDs unusable. If it's an authorization then its explicit purpose is to either supervise or out trans people.