That may actually be true.
From that 'Make-Believe Maverick' article in Rolling Stone (just the handiest source, I've seen this idea in a lot of spots)...
In June 1968, after three months in solitary, he was offered what he calls early release. In the official McCain narrative, this was the ultimate test of mettle. He could have come home, but keeping faith with his fellow POWs, he chose to remain imprisoned in Hanoi.
What McCain glosses over is that accepting early release would have required him to make disloyal statements that would have violated the military's Code of Conduct. If he had done so, he could have risked court-martial and an ignominious end to his military career. 'Many of us were given this offer,' according to Butler, McCain's classmate who was also taken prisoner. 'It meant speaking out against your country and lying about your treatment to the press. You had to 'admit' that the U.S. was criminal and that our treatment was 'lenient and humane.' So I, like numerous others, refused the offer.'
'He makes it sound like it was a great thing to have accomplished,' says Dramesi. 'A great act of discipline or strength. That simply was not the case.'
Evidently there are also Geneva Convention considerations to accepting early release when there are still POWs. (First I've heard of it, unsure of accuracy.)
And he was ambitious enough to be thinking about politics back then, I think.