As several commenters have noted, medical rules are different in each country. ICAO provides guidelines and recommendations, but it's up to each country to actually implement them. ICAO's personnel licensing requirements are in Annex 1 which is not freely available but their Manual of Civil Aviation Medicine implies that transgender pilots should be considered 'higher risk':
Applicants with disorders of behaviour (for example regarding habit,
gender identity, sexuality) should be assessed on the basis of their
ability to put aside the disorder (or any conflicts related to the
disorder) in order to attend to the aviation task at hand. These
persons may have significant conflicts with their environment, leading
to further difficulties, which may become an impediment for them to
hold an aviation licence.
Looking at specific countries, the FAA may be an unusual case by explicitly mentioning gender identity issues. I couldn't find any mention of them in the EASA, Canadian or UK medical requirements. But all countries' medical requirements include something general like this (this example is from EASA):
(g) Personality or behavioural disorder Where there is suspicion or
established evidence that an applicant has a personality or
behavioural disorder, the applicant should be referred for psychiatric
opinion and advice.
That catch-all clause would - I assume - include gender identity disorder and therefore require psychiatric evaluation of the pilot. And in cases where a pilot has had gender reassignment surgery and/or drug treatment, the surgery and drugs regimen would almost certainly trigger additional testing and investigation (so would any other major surgical procedure or long-term drug treatment).
Finally, it's worth noting that whatever the general rules are, every case is different and the only way to get a specific answer for an individual is to consult with an aviation medical examiner for that jurisdiction.
(Disclaimer: I know nothing about medicine except that it's complicated. Consult an aviation medical specialist if you want a real answer.)