I mostly or completely agree, Terro; I'm just not entirely clear on one thing based on your words.
Sex is determined by what the chromosomes and the sex organs are. Gender is determined by identification with a particular gender concept or category.
For Blake, or Shang, or anyone else living in a body that does not match up with the person's gender, that person's perception of self still determines gender. Current perception, not what that person feels zie used to be, which I understood to be your meaning - but also not current genetic or genital characteristics. (Awkward wording. But I was trying hard to avoid the word "biology" there - what happens in the brain is also governed by biology even if it's not singing the same tune as the rest of the body.)
Experiences before this life could influence a gender-flexible brain to lean toward a particular, set identity. So could the organs and hormones. So could socialization. But I also don't think that souls or past lives dictate gender, any more than organs and hormones do, or socialization does. (The track record
for treating gender as merely a social construct is not too good.)