A Mars colony, even if self-sustaining, doesn't even ensure our species survival against several plausible end of the world scenarios.
A gamma ray burst event works on the scale of *solar systems*, not worlds. If our system is sterilized by by a GRB we die, be it on Mars or Earth or the Kuiper belt. There is no defense except interstellar civilization.
The theorized quantum vacuum destabilization will end all existence in the galaxy and beyond, let alone our little sliver of it. A new pocket reality of low energy space will expand from some point, and when it reaches us at light speed our bodies and worlds and ships will just stop being things. Not even an interstellar civilization could survive. We would need FTL ships capable of crossing the unimaginable distances between superclusters to keep our species going as super clusters are receding from each other faster than light, so a Doom-o-sphere expanding at light speed will never reach us.
The sun's massively increased energy output in a billion years, predicted to evaporate the oceans and bombard the Earth with intense stellar radiation, will ironically only make Earth slightly less hospitable than Mars is right this second. Mars is already lacking a magnetosphere to predict it from radiation, its oceans have already boiled away into space, its advanced forms of life - if they ever existed - are all long dead and would need to be re-introduced by humanity to make a colony self-sustaining.
Finally, nuclear war. Contrary to popular belief, full scale nuclear war will not end all life on Earth. There are simply too many people living in too many places for us all to ever die to modern nuclear bombs - which are as far as can be done with a nuke surgical instruments for devastating the enemy's nuclear and industrial capacity. And even if we did invest in planet-killing weapons, like Szilárd's theorized 'cobalt salted bombs', ICBMs can easily become IPBMs (interplanetary ballistic missiles). Allowing politicians can ensure Mars dies along with Earth when the day comes (we all know politicians love sharing). Being on Mars buys you a weeks of life before you too are killed.
The only scenario an extra-planetary colony saves us from is asteroid impact. A big rock from space, short of a Theia-level planet-to-planet collusion which liquefies the crust, is a lot like nuclear bombardment in that there is little chance of it killing us. Again, there are too many of us and we're too spread out. So long as multicellular eukaryotic life exists, humans can exist - we fuck like rabbits and are pretty clever. The only advantage of a Mars colony is help restarting Earth's technological base after the dust clears, which why not built time capsules for cheaper?
So yes, a rogue planet slamming into Earth is pretty much the only time "humanity" really needs an extra planetary colony. And that seems so unlikely it strikes me as bizarre to try and plan around it.