Sans' real goal was creating a machine to free monsterkind, not transport himself to an alternative hostile universe. And though while it may seem that the latter only threw himself into hell itself, he might have just found the happiness he was missing. (Basically how Red and Sans met and fell in love and shit)