Memory tracing. It's not only common in Kingdom Hearts but other Square Enix stuff. FFIX did the exact thing with a world made of memories from others stretching as far back as to the formation of the world. If Kairi is going through her own memories and connect with Sora then it might lead to memories of those connected to Sora too. This honestly feels like something Namine should be doing if that's the case though.These can't be Kairi's memories. When did she witness Xion's death or Xemnas' final boss fight? Does she have Sora's KH2 memories and Roxas/Xion's memories? If so, how and WHY?