This is also a very interesting aspect of Nomura's time travel because it involves the memory concept of the games. If the so called chain of memories is broken not only the person that has these memories forgets about them but all people that share this memory. Remember that in KH2 the Hallow Bastion crew told Sora that they (and Kairi & Selphie) completely forgot about him (until his memories were restored)? Also "the end of Xion" in 358/2 Days eradicates/alters all memories that involved her.
Now if YMX "looses" his memories doesn't this mean that Sora, Riku and Mickey also forget about the encounters with him?
If someone can provide the time travel quotes from the game, that would be really helpful.
edit: sorry, I went a bit overboard with the answer.. finishing the game made my head explode.
In CoM, Sora's memories where altered by Namine that changed the links in his chain of memories. That caused problems with everyone previously linked to Sora's memories.
Xion was made up of some of Sora's memories and when she returned to Sora, those original memories kinda "broke free" from the rest. Without a connection, people who knew her started to forget her.. I think. Or basically the new memories made by Xion weren't part of Sora's original memories, so they got sealed. In 3D, while in the dream version of TWTNW, Roxas kinda "unlocked" his memories? They were all inside Sora but were sealed because they weren't Sora's, so that's why he continued to be the "guy without a clue"
As for YMX, after he returns to his own time, the memories that get erased are only his own memories (except for the need to set all those events in motion). This could be probably because Sora and the others still know Xehanort through his many forms, so they still have a link to him?