I didn't read every post so this may have already been said but what if KH3D takes place between KH1 and KH: Chain of Memories. I may be wrong but if you think about it it was never really explained how Sora or Riku ever got to castle oblivion, they just sorta showed up there.
Another thought what if the Sora and Riku are just clones like Xion and the Riku Sora fights in castle oblivion, maybe something like the Organisation trying different ways to get a key bearer.
Edit: Just read the post above mine and discovered that it takes place after coded...So now that we're discussing the fact that it's time travel let me throw this out there (yet again something that has probably already been said on here so I'll look like an idiot for repeating it). Riku and Sora may need to be sent back in order to put things right. Like someone is trying to mess with their past so they have to keep the person from altering anything by defeating the enemy's that have been sent back.