Everything the Doctor did in his life still happened even after he was erased. Even though the cracks erase things from history, they don't erase the effects of those things' existence. We've seen this a number of times before in instances concerning the cracks:
- Even though the Weeping Angels were erased, the Byzantium still crashed.
- Even though the cleric who gave Amy her communicator was erased, she still had the communicator.
- Even though Amy's parents were erased, she still existed.
- Even though Rory was erased, his ring was still on the TARDIS and there was still a photograph of him in Amy's house.
- Even though the Doctor was erased, Amy still had dolls and pictures of him on her desk.
As you can see, these are paradoxes. However, that is what the cracks do - they rip things out of causality but don't account for any of the changes that doing so would normally cause, so they generate all kinds of contradictory situations that don't make any sense from a logical standpoint. People in the show never notice this because the cracks also affect one's memory and, it seems, their perception as well to a certain degree, as the cleric from "Flesh and Stone" and Amy herself insisted that his fellow clerics and her parents, respectively, had either never been there to begin with or had been "lost." However, the Doctor notices, and that is why he says that he life doesn't make any sense - it's missing a bunch of important chunks, but it still happened even though she herself should no longer exist. It's the same way with the Doctor once he is erased. He may be gone, but his "footprint" on the universe (saving worlds, defeating enemies) is still there, and until Amy remembers him back into existence, it doesn't make sense (but nobody notices because they were made not to think about it by the erasure itself).