https://en.wikipedia.org/wiki/Repatriation_of_Ahmed_Agiza_an...
I'm sure he'd prefer to leave the UK too if he could, but between Sweden and the UK, when facing this amount of scrutiny from the US, the UK is his obvious choice since they don't allow extraordinary rendition starting from their soil.
And the reputation the US used wasn't their good side, it was the economic threats against Sweden that made them capitulate. The US is still more than willing to take such measures to get what it wants.
(The UK makes dubious decisions to repatriate asylum seekers to countries like Egypt all the time FWIW)
It is reasonable to think that the Swedes have identified a different avenue that they can use to have Assange leave the country care of the US, and that they would exercise that option once they have him in custody.
That is almost certainly what Assange thinks. I don't know I've ever seen the likely penalty for what he was charged with, but I doubt it is more than a decade and he would have spent longer than that in the Ecuadorian Embassy the way things were shaping up. His actions are only rational if he is expecting the US to be involved.
It's certainly amusing to see Assange fans rewrite history to make the UK the good guy when it comes to not cooperating with the US over extraordinary renditions (or indeed ordinary ones). Even the UK government wouldn't make that claim.