The Rambam writes (Hilkhos Melachim 10:12):
אַפִלּוּ הַגּוֹיִים צִוּוּ חֲכָמִים לְבַקַּר חוֹלֵיהֶם, וְלִקְבֹּר מֵתֵיהֶם עִם מֵתֵי יִשְׂרָאֵל, וּלְפַרְנַס עֲנִיֵּיהֶם בִּכְלַל עֲנִיֵּי יִשְׂרָאֵל, מִפְּנֵי דַּרְכֵּי שָׁלוֹם: הֲרֵי נֶאֱמָר “טוֹב-ה’ לַכֹּל; וְרַחֲמָיו, עַל-כָּל-מַעֲשָׂיו” (תהילים קמה:ט), וְנֶאֱמָר “דְּרָכֶיהָ דַרְכֵי-נֹעַם; וְכָל-נְתִיבוֹתֶיהָ שָׁלוֹם” (משלי ג:יז).
[Not only Jews and geirei toshav (resident aliens),] even for non-Jews our sages commanded to visit their sick, bury their dead [as] with the Jewish dead, support their poor among the Jewish poor, because of darkhei Shalom. For it says, “Hashem is good to all, and His Mercy is on all that He made.” (Tehillim 145 “Ashrei” v. 9). And it says, “[The Torah]’s ways are ways of pleasantness, and all its paths are peace.” (Mishlei 3:14, also said when returning the Torah to the aron)
Rav Aharon Lichtinstein zt"l points out that the Rambam's prooftext for "darkhei Shalom" are about (1) imitating G-d, and (2) that the authentic ways of the Torah are to be pleasant and advance peace. It would seem that the common understanding of Darkhei Shalom is wrong. Rather, we express our concern toward non-Jews for the sake of remaining on the path of peace, because that is Hashem's Path. (Compare the list of examples the Rambam gives here with the list of kindnesses the Talmud [Sotah 14a] shows us examples in the Torah of Hashem doing.) Not pragmatics or PC, but a fundamental part of the ideal.
Rav Lichtenstein translated the relevant snippet of a responsum by the Rama (#11) to show that peace in-and-of-itself, without any implications of future danger, is sufficient reason to override some prohibitions:
We have learned from here that it is permissible to modify [the truth] for the sake of peace, and it is permissible to violate the injunction, “Thou shalt distance thyself from falsehood.” [The consideration of peace] also overrides the biblical prohibition of “Thou shalt not do thus to the Lord thy God,” which bans the erasure of God’s Name, as is explained in the Sifri to Parashat Re’eh and counted by the Rambam and the Semag in their respective enumerations of the mitsvot. Since this is so, I say that it is also the case that [peace] overrides the prohibition of defamation; in other words, it is permissible to defame another if one’s intention is for the sake of Heaven and for a good cause, [namely,] to promote peace.
(The above is based on an email from Yeshivat Har Etzion from decades ago that I could not find a copy. However, it is very similar to Rav Aharon Lichstein's article “In The Human and Social Factor in Halakhah”, Tradition 6 (2002) pp. 89-114, made available on-line by the Lookstein Center for Jewish Education at Bar Ilan Univ.)
A similar idiom that is also commonly understood on pragmatic grounds is "mishum eivah -- because of enmity", usually explained as reason to permit something because the enmity likely caused by observing the prohibition may pose a threat. neither idiom is used not used exclusively where there is real risk to life or limb, but that would have to be the meaning of the phrase if it were pragmatic grounds to override Shabbos. Mishum eiva is applied between father and child on Bava Metzia 12a; on Yuma 12b to the kohein gadol; and on Kesuvos 58b, between husband and wife. So avoiding eivah is a value of some sort detached from the value of saving people from future retaliation. But we were looking at darkhei Shalom in particular.
There is a story in the gemara (Sukkah 53a) where David haMelekh dug deep holes into the ground as part of his preparations for the future building of the Beis haMiqdash. He dug far enough down to hit the tehom, the subterranean water, and the water came up threatening to drown the world. Achitofel wrote the name of G-d on a pot sherd and through it down the hole, thus stopping the water. He reasoned from the law of sotah, where a paragraph of the Torah that includes Hashem’s name is written on a parchment, dissolved in water (along with some dust from under the Beis haMiqdash) and given to a sotah — a married woman accused of adultery who then is found alone with the suspected paramour. Achitofel reasoned that if Hashem’s name may be erased to save one marriage, then of course it may be erased to save the entire world.
So, darkhei Shalom and mishum eivah are in reality expressions about advancing world peace and global harmony, and as per the above Rambam, imply a responsibility of Jews toward the welfare of non-Jews.
The expression "tikun olam - establishing the world" or "tiqun olam - repairing the world" found reconjugated in Aleinu (whether the word has a kaf or a quf depends on differing traditions) refers to a spiritual repair (assuming it is "repair", not a social one. Although it is possible the implication is a social repair that thereby engenders a spiritual one. But the phrase is "lesakein/lesaqein olam bemalkhus Shakai -- to establish/repair the world into the kingdom of the One Who Set Limits, and all children of flesh will call in Your Name..." So, if it meant action, it would be a call to prosletize, not social justice. It is generally taken to be about setting an example.
The phrase tiqun olam as it appears in the mishnah and tosaefta, though, is indeed about social cohesion. See Mishnah Gitin 4:2-5:3, Edios 1:13; Tosefta Kesuvos 12:1, Gitin 3:8, Terumos 1:14-15. The contexts there involve the soundness of marriage and divorce; pruzbul to make loans to the poor more common; not leaving a slave in half-enslaved half-free limbo; not overpaying for captives so as to avoid making hostage taking too tempting; nor for a Torah scroll, tefillin or mezuzah in the hands of a likely thief, to prevent a market enticing more such thefts... The first 12 are all to protect the have-nots. Gittin 33a explains another case seimilarly, with a debate as to whom the have-not is.
So, while there is grounds for associating tiqun/tikun olam with social justice, all the examples are within Jewish society. Even though the expression is about "olam", the world.
Perhaps this is because our social responsibilities start with those closest to us. If two people are in the desert, and one of them has water but just enough for one person, we follow Rabbi Aqiva that the person is supposed to take the water for themselves. (Bava Metzia 62a) And when figuring out the proper "triage" for whom to give charity to, one's child (an adult offspring) comes first, then one's parents, one's other relatives, the poor of one's hometown, etc.. Rav Herschel Schachter taught (I do not know if this is recorded anywhere) that in today's world of telecommunications and rapid travel, "our city" has to also taken metaphorically -- not just those closer to us in geography, but also in our social circles regardless of location. See the Shulchan Arukh, Yoreh Dei'ah siman 251 for these laws of priority. In fact, the law we saw in the Rambam about "supporting [non-Jewish] poor among the poor of Israel" is placed in this context (Ibid, se'if 13).
Our social responsibility starts with those closest to ourselves, in ever-widening circles of concern. So, in terms of triage -- family, friends, our sub-community of Jews, all Jews, and only then non-Jews.
Rav Shimon Shkop wrote that this is because chesed (lovingkindness) is not an act of abnegation, but of extending one's self and one's natural self-interest to include an ever broadening definition of "me and mine" (introduction to Shaarei Yosher, translation mine, emphasis added). Note how far our we get before we talk about social justice for the general world:
Although at first glance it seems that feelings of love for oneself and feelings of love for others are like competing co-wives one to the other, we have the duty to try to delve into it, to find the means to unite them, since Hashem expects both from us. This means [a person must] explain and accept the truth of the quality of his “I”, for with it the statures of [different] people are differentiated, each according to their level. The entire “I” of a coarse and lowly person is restricted only to his substance and body. Above him is someone who feels that his “I” is a synthesis of body and soul. And above him is someone who can include in his “I” all of his household and family. Someone who walks according to the way of the Torah, his “I” includes the whole Jewish people, since in truth every Jewish person is only like a limb of the body of the nation of Israel. And there are more levels in this of a person who is whole, who can connect his soul to feel that all of the world and worlds are his “I”, and he himself is only one small limb in all of creation. Then, his self-love helps him love all of the Jewish people and [even] all of creation.
In my opinion, this idea is hinted at in Hillel’s words, as he used to say, “If I am not for me, who will be for me? And when I am for myself, what am I?” It is fitting for each person to strive to be concerned for himself. But with this, he must also strive to understand that “I am for myself, what am I?”
And so, the ideal great soul does have a self-interest in all of humanity. But there is so much work until we get there that takes higher urgency.