That's what I liked about his character development from S5-7. The set back of trying to rape Buffy made no sense to me, taking how far he had already come. Take his friendship with Dawn, he became like a brother to her when Buffy died and not only that, he took the beating of a lifetime from Glory all in the name of keeping Dawn safe.
Sure he slept with Anya, who wasn't with Xander at that time, and yeah he got himself his own personal sex slave in the Buffybot, but they are not evil acts, certainly not for a Vampire anyway. Those kind of occurences showed that Spike the Vampire was still alive. There was no need for the rape attempt, that suggested he never really changed and all the goodness that he had done was all in the name of his obsession for Buffy.