I have no answer for it, wouldn’t know where to start. The unionist media pounced upon the trans prisoner issue as another stick to beat the SNP with, nary a mention that England & Wales have more trans prisoners per capita than Scotland. The trouble was, as you say, the SNP tried to address the issue.
The SNP and the indy movement have taken an absolute beating in the polls because of it, but I'm certainly they went ahead with anyway as it was the right thing to do, and a manifesto commitment - not to mention it had cross party support. I hope the new leader continues to try and get the legislation through via the courts.
The trans rapist prison thing was an absolute nonsense story, moral panic whipped up by the media, but unfortunately it has had massive cut through.
You are right about the factions, the old guard (likes of Fergus Ewing, Mike Russell etc) I think are a bit bitter about losing control over the party. I can't see them and the more conservative side of the party winning any leadership election though.