It's a bit of a false dichotomy to suggest we have to choose between the two, but...
If we must choose, we should choose to colonize Mars. Statistically speaking, an asteroid impact is inevitable. Time is the relevant variable. The sooner humanity can be a multi-world species, the sooner we are more robust against that threat. The same will be true of our successors who will necessarily have less time than we to spread from Earth. If we manage to spread to other worlds and Earth is destroyed, we will still be around to develop our successors (and will also have a leg up on spreading to ever more worlds). If we manage to create our successors and the Earth is destroyed before we get to other worlds, it's game over.
You're just re-stating the original argument for colinization (an asteroid/event would make the earth less inhabitable than mars is currently) that I disagree with and originally addressed.
I don't think so. For most asteroid impacts, we wouldn't even need to build subterranean shelters for the species to survive. It isn't enough for the species to survive. Our civilization, particularly our very technological civilization, must survive as well. Without such a civilization, we'll be trapped here until the Earth itself dies. Our long term survival depends on the short term survival of our civilization.
The relative habitability of Earth and Mars may actually have a converse effect on the survival of a technological civilization. On Mars, such a civilization would be necessary for continued individual survival for what may be geological time scales. On a recovering Earth, humans may salvage civilization, devolve into a new and indefinite dark ages, or give up on civilization entirely and the species will still go on.
If we must choose, we should choose to colonize Mars. Statistically speaking, an asteroid impact is inevitable. Time is the relevant variable. The sooner humanity can be a multi-world species, the sooner we are more robust against that threat. The same will be true of our successors who will necessarily have less time than we to spread from Earth. If we manage to spread to other worlds and Earth is destroyed, we will still be around to develop our successors (and will also have a leg up on spreading to ever more worlds). If we manage to create our successors and the Earth is destroyed before we get to other worlds, it's game over.