Ted doesn’t have kids or a wife. Everything after the episode “Time Travelers” is Ted still sitting in that booth, alone, and imagining situations while his friends go on with their lives. His imagination is the only place where Robin would love him, anyways.
Ted is telling his kids how he met their mother because they could die at any moment, since by 2030, there will obviously be a zombie outbreak. Ted leaves the house and runs to Robin’s apartment, only for Robin to eat him to death as the camera slowly zooms to the bloody blue french horn.