Leon associated the Heartless Invasion with Maleficent taking over, yes?
That happened Nine Years Ago. It was said that, during the invasion, Ansem disappeared, so they assumed he was done in by whatever started the invasion. Now, knowing that Maleficent NOW resides in HB, and commands the Heartless, Leon put two and two together, so to speak, and blamed her.
Then, at the end of the game when it is revealed that "Ansem" was really the one behind it, as he was behind the Heartless, Leon reassessed it. He says that, originally, he thought that Ansem had died protecting his people, but, in reality Ansem was the one "who brought them there" (The Heartless). Therefore, if he now realizes that "Ansem" was behind the Heartless Invasion, then that means that Maleficent -didn't- take over then. Basically, by the end of the game, everyone realizes that the Heartless was really "Ansem"'s doing, and not Maleficent.
Now combine that knowledge with the following facts:
-Xemnas was the one who banished Ansem.
-Xemnas made the Chamber of Repose after banishing Ansem and was said to visit there frequently
-Xemnas reinstated the MCP in Space Paranoids.
It becomes clear that Maleficent didn't take over nine years ago.
Plot Hole adverted. La-di-da.
the bold in particular show off quite well why "Maleficent took over nine years ago" doesnt add up.