For a while I've been trying to think of a reason behind this theory. If the data in Sora is comprised in part of Riku's memories, then what is it about Riku that could help save those in torment? I've got one idea in mind, and it has to do with another theory of mine:
http://forums.khinsider.com/spoilers/146748-seeds-have-been-planted.html
(read the op in there before proceeding)
Riku has (or rather had) Vanitas' heart inside him. I know this doesn't sound all too appealing, but there are a few reasons why it adds up.
First, as I said in that topic, I think MX could have deduced that Ven's heart was connected to Sora. He wouldn't have attributed his recovery of the keyblade to some act of providence, I'm sure, and he could undoubtedly sense a change in Ven's heart as well. So, by connecting Vanitas to Riku's heart as Ven was to Sora's heart, he could ensure that the X-Blade could be created in the future should it fail the first time Ven and Vanitas tried to fuse.
But there's another reason why it fits, and it has to do with timing.
Check out this line of events:
1. Terra picks Riku to be his successor.
2. Terra goes to save Ven from Eraqus, transporting him on Destiny Island.
3. On Destiny Island, Ven meets Vanitas (who was there before him).
Question: What was Vanitas doing on Destiny Islands? Surely he couldn't have known that Terra would save Ven and transport him there. Vanitas had to be doing something. But what? Again, these events happen back-to-back. In other words, Vanitas went to Destiny Island
directly after Terra chose Riku to wield the keyblade. Coincidence?
If Aqua could sense that Riku was chosen, so could Vanitas. And going back to the idea that MX and Vanitas knew about Sora's connection to Ven, I think Vanitas saw the perfect chance for his own fail safe back up plan.
I was always surprised at how Aqua noted that Riku's heart was filled with light. For some reason I thought he would be like Terra, naturally inclined to have a bit more darkness. Instead, he was light in the beginning, but Vanitas' darkness twisted him over the years, accounting for the change Kairi senses in him (hence why she tells Sora to never change). It also explains, obviously, Riku's dark suit. I know people chalk it up to being a coincidence, a rehashed design, but, really, there are only two occurrences of the suit in the series (Vanitas and Riku). Given Nomura's tendency for connections via physical appearances, there really ought to be some sort of reason for why the suits look so similar. And, after all, we already know that when Vanitas goes into another's heart, they aquire the suit- just look at Ven (in the scene where he has his armor on, but it melts into the dark suit). Riku's suit is slightly different for a potential variety of reasons, but I think that fits nicely.
But where am I going with this? Vanitas is inside Riku, so what?
This is where DiZ comes into play:
He wanted to find out about Xehanort's past via his tests and research the darkness of the heart. Knowing this, would Riku not be the perfect sample? He's got an abundance of darkness which he somehow managed to control (for the most part), AND he's harboring Xehanort's heart.
So, I think Riku may have been the subject of some testing. And what DiZ found was entirely unexpected.
Instead of just finding out about Xehanort's past, he found Vanitas' memories in there as well. Coupling that with Namine's discovery in Sora, I think he may have put the pieces together. He realized that Sora and Riku were harboring the two halves of another being, Ven.
Knowing this, he decided to put his device to good use- the Heart Encoder.
He extracted the portion within Riku that was comprised of Vanitas' heart by converting it into data, and he placed that data into Sora. However, this had an unforeseen side effect: Vanitas' heart was so deeply ingrained in Riku's that by extricating it, some memories of Riku had come out as well since they latched on. Now Sora has the two pieces of the puzzle in his heart. DiZ left the rest up to him, hoping that he could find a way to put them together.
One question you may be asking is why, if DiZ could do this, didn't he just extract Xehanort's heart as well and save Riku all that trouble? And there's a simple answer, best put by Riku himself:
Just like how he chose to fight Ansem rather than lock him away when Namine gave him the choice, Riku chose to keep Ansem in his heart rather than extract him. He would need the power of darkness in order to bring back Roxas.
Interestingly, this theory entails that Riku
knows about the data in Sora. And that's a distinct possibility.
Note that when SRK are reading the King's letter, Riku has a knowing smile, as if he expected this to happen.
And there's another hint. Before AtW went kablooey, one of his last words was, "Riku, you know what to do!"
What DOES Riku know? When you think about it, addressing Riku there was awfully peculiar. I think they all knew they had to stop Xemnas at that point, so he had to be talking about something else.
So that's it. That's my best shot at the moment.
As for why restoring Ven's heart would help save those in torment, it has to do with the X-Blade. By fusing these two halves once more, the X-Blade could be created. In that case, Sora would be the owner, and I'm sure he could use it to "Open the door"...
Oh, and if this is true, I think it's a strong indicator that the main antagonist in KH3D is Vanitas (assuming that KH3D is what I speculated it to be).