I think this is how it goes: Muchos dusttale routes have been played. Then, the human did pacifist. sans was aware of the dusttale routes though. so then, he kill everyone. sans asks you why you made him kill everyone. then the battle starts.
Credit goes where it is required. like hell i'm making this, you do it