SPOILERS for the endings of Undertale below, obviously.
So, during the Neutral route, Asgore fights Frisk, and then is killed in the end. If the player follows Flowey's advice and does a LOAD to get a better ending, time/space is reset to a point before that fight. Frisk heads to the True Lab, helps Alphys and the Amalgametes, and the next time he encounters Asgore the fight will be stopped by Toriel. Nobody has to die, hooray!
But what event within the story actually caused the fight with Asgore to change? Why did Toriel show up at the fight the second time instead of the first? It can't have been because of the events in the True Lab - they had nothing to do with either Asgore or Toriel. No message is sent to Toriel during the Pacifist route to bring her to the castle. There seems to be no causal connection between Frisk's activities after the LOAD and the new outcome when Asgore is prevented from fighting Frisk.
The only thing I can think of is that Toriel was on her way to the castle the whole time during the Neutral Route, but didn't arrive in time to save Frisk or Asgore. However when Frisk detoured to the True Lab after the LOAD, that gave her enough time to make it to the castle and give Asgore a face full of fireball before he could start the fight.
Is there something I missed? Did Frisk do something on the Pacifist route that directly resulted in the changed encounter with Asgore?