According to the scientific material that I have read, soul has nothing to do with such, the soul is the power of intellect and our base of self. Even some described it as genderless, however soul is studied under philosophy.
Gender is studied under psychology, sex is studied under biology. And combination of sex and gender is studied in psychology and physiology.
So odd gender sensations that means sex does not correspond the gender are fixed by psychology because these are psychological problems. And problems in Islam are tests in Islam to see whether a human solves it rightly or disobeys Allah swt in it. So by exhorting efforts and proper psychological treatment and Duas every thing can be fixed. Many of those I know have such problems and now they are straight.