It's a very exciting, multi-generational project to think about. Though frankly I think we're going to get AGI + brain/computer interfaces + cloud mind uploads before we get martian terraforming; and dropping the bag-of-meat related requirements would make extraterrestrial colonization much easier.
That's also the best option, not betting on a single idea or technology.
So, having humans on Earth + Mars at best only marginally improved the chances of humanity surviving long term than only having humans on Earth, by a tiny amount.
Humans actively monitor and defend against each threat. In the U.S., NASA is committed to detecting asteroids, and recently successfully altered the course of one [2].
I believe we are most powerful to overcome extinction events as a united species on the planet we’ve evolved to live on over billions of years.
[1] https://en.m.wikipedia.org/wiki/Human_extinction
[2] https://www.jpl.nasa.gov/edu/news/2022/9/22/the-science-behi...