There's a parallel here with economic freedom. The idea of granting people economic freedom and the ability to accumulate capital opens up great potentials for inequality. This is hardly a point where we have to speculate into the future or look into the past, we see it right here and now. But it's also, in the big picture of the economic success of our society, a big winner. There are plenty of things economic freedom alone does not accomplish, and we need to work in other ways as a society to accomplish those things. Social justice is one, but there are plenty of others. Economic freedom didn't get us to the moon, and it didn't defeat Hitler. It didn't even create the Internet. But it did help us build the society that pooled together its resources to get to the moon, defeat Hitler, and build the Internet (and then it took the Internet and ran with it).
Our global society's protection of its environment and wise stewardship of Earth's resources will contribute greatly to its success or failure over its next few hundred years. If we do or if we don't succeed we'll have to work continuously for social justice. If we do we may have the great privilege of working for social justice in a world that continues to sustain us, where peace and prosperity is possible. If we don't we'll be working for social justice in a world of famine, shortage, and war. Of course when the rubber meets the road we should create specific policy that furthers the end of social justice. But when it comes to doing what's in the long-term overall interest of our society, we can't just declare that incompatible with social justice and do nothing.