There’s a lot of possibilities so long as you have a society that can think in terms of generations rather than single lifetimes, or you accept that to go adventuring you need to truly leave your old life behind.
I tend to believe that the sort of long thinking necessary to colonize the stars is also what’s necessary to repair the Earth (in both cases you’re talking about projects whose timeline is centuries or millennia).
I do think humans are more tenacious in the face of adversity than the pessimists believe (and more pugnacious than the optimists are willing to accept).
So as bad as things get, I do believe that we’ll both make it through and off the rock. It’s just a question of how long it takes, and how many people get thrown in the fire in the meantime.