Well he begs to die on rivalry path only. In friendship he is like "I did what I did and I am one with Justice and I stand by my decision. If I must pay for it with my life then I pay, at least Justice will be free." He doesn't beg to die but he is ready to die. Also if you spare him he kinda "changes back", judging from his conversation before last confrontation with Meredith.
Actually, I was thinking more along the lines of Anders walking on the path of mage freedom because of Karl's letters, and the tranquility that was imposed on Karl. It seems like it's Karl's death that leads to Anders becoming involved with the mage underground, since he turns to a relative stranger when he plans on helping Karl escape his templar captors.
Regarding what you said, I think Hawke's friendship allows him to come to terms with his symbiosis with Justice, while being a rival to Anders causes the two personalities to come into conflict.
In romance, Anders admits his surprise to Hawke that he wasn't killed. "I should have trusted you. Even with all we've shared, I never thought you'd spare my life." He also seems to realize how difficult the progression for mages will be: "Kirkwall can't change along, love. Even if we win here, it will take years of open warefare throughout Thedas before mages can be safe." He proclaims: "We can build a world where no one dies for being how the Maker created them. Ten years, a hundred years from now, someone like me will love someone like you, and there will be no templars to tear them apart."
In friendship, Anders does express surprise as well: "I underestimated you, Hawke. I really thought when it was put to the test, you'd have to kill me. You truly are the leader we've been waiting centuries for." He also shows his Andrastian faith: "May the Maker bring us victory. Maybe if He shows His approval, the world will finally be ready to change."