Namine, on several occasions, did try to warn Sora of the danger in Castle Oblivion as she was messing with his memories.
I think it's confirmed, or at least implied, but I'm not too sure. I don't remember much about CoM. :/
But yeah. It would make sense if that was Namine's doing.