Here is the explanation:
Frisk knows Tori because she was one of the first monsters they met.
Tori knows Sans because they met at the door.
Sans knows Paps because they are brothers.
Paps knows Undyne because they "Practice" together.
Undyne knows Alphys because apparently Alphys almost committed suicide in the dump.
Alphys knows Asgore because she is Asgore's royal scientist.
Asgore knows Asriel because he is Asgore's son.
Asriel knows Frisk because... IDK maybe like their soul or something is chara or something? (I don't know the lore)
Its all been one huge circle!