In ילקוט יוסף, אוצר דינים לאשה ולבת, פרק נ"ו, he writes about gender change surgeries. He initially discusses whether a woman would still need a get if her husband had a gender change surgery done and now considered himself a woman.
He then writes regarding the permissibility of performing such a surgery:
ועכ"פ ברור שאסור לאיש לעשות ניתוח כזה, דמלבד שמפקיע מעצמו מצות האיש
(אף שיש לעיין דשמא עדיין חייב בכל המצוות כאיש) גם עובר על איסור סירוס,
וא"צ להאריך בזה, ופשוט דהוא אסור ע"פ ההלכה.
In other words, it is forbidden to do the surgery because one will be removing himself from the obligation to do the mitzvos that a man is obligated to do (although he writes that it is possible that he is still obligated to do all the mitzvos incumbent upon men, despite his surgery).
The implication is that by doing the surgery he is effectively a woman and no longer obligated in mitzvos that are specifically for men. Therefore one might thing that Yichud should apply. However he himself is not completely sure as he adds that perhaps the person is still obligated in mitzvos. It is clear however that his primary inclination is that the surgery is effective.
Presumably at least as a safek R' Yosef would rule that Yichud applies.