I'll try to do my best and answer these questions one by one. Note that I did not add any quoted sources to the actual text of the answer, as it might have made this unreadably long. If you don't have the time to read all of it now, see just the quote at the end:
You ssked: Why is this prayer here? And: Why would we need to pray for peace here if we just ended the shemona esre with a blessing for peace?
Shemoneh Esrei is meant to end with a Nesinas Shalom, or "Giving of peace", as DoubleAA pointed out (Yoma 53b). But, the prayer at the end of Shemoneh Esrei is from Berachos 17a (which was added by Mar Bereih Deravina) does not finish with Shalom. Thus, we added on this "saying" which was a standard phrase already (see below), or because this is a "Giving of Shalom", whereas the Beracha of Hamevarech es Amo Yisrael is not (for whatever reason).
The Chavrusa Gemara notes suggest that the source of this saying here is the Tur, as they note the Ritva there (could not find it), who has a different wording that was used. "ויש נוהגין לתת שלום ממש, שהם אומרים שלום לימיני שלום לשמאלי."
However, it appears to be much earlier than the Tur, as Rashi in Likutei Hapardes seems to have had this wording at the end of Shemoneh Esrei, as does Machzor Vitri, and other early Rishonim.
You asked: It seems to end other prayers as well such as kaddish and the harachamans following bentching. Is there a common thread?
There indeed is. Rashi in the Likutei Hapardes above notes that even in his time, the Passuk ends all of these places, the only question is how it got there.
One approach is the "one-by-one" approach. It seems to be that there was a reason to end Shemoneh Esrei like this (as above), and that it was somehow transferred to Kaddish, either because the Sha"tz did not take his steps back until that point (based on the Shitah of the Ri"tz Gias brought in the Hearos of Yalkut Yosef Siman 56:3).
Based on the Tzlosa Deavraham (siddur, I think) Rav Shmuel Pinchas Gelbard suggests here that it was simply moved to Kaddish as a translation of Yehei Shelama Rabbah. This happens to fit in very well with this conversation, based on Rashi (quoted above), who says that this last line was so the Malachim could understand. (Although it seems more likely that it was taken from Kaddish or Birkas Hamazon to everywhere else, as many earlier sources have it everywhere except for Shemoneh Esrei.)
That explains Kaddish. For Birkas Hamazon, Mateh Moshe gives two potential reasons for adding in a "Shalom line" to finish bentching:
From the Pesukim in Bechukosai (Vayikra 26:4, 6) where it says that God will give rain at the appropriate times, which is followed by him saying that he will place Shalom in the land. See Toras Kohanim there which emphasizes this juxtaposition (even quoting the words of the Passuk "Oshe Shalom" in Yeshaya 45:7), and Mateh Moshe suggests that it is the reason for our juxtaposition.
He quotes Chazal (Chagiga 27a) that one's table is considered to be like the Mizbeach, and he notes that the last Korban mentioned in "זאת התורה לעולה למנחה ולחטאת ולאשם ולמלואים ולזבח השלמים" (Vayikra 7:37) is the Korban of Shalom (Sifra Vayikra 16).
Note that Seder Rav Amram Gaon has עושה שלום במרומיו הוא יעשה שלום על כל ישראל in Birkas Hamazon and Kaddish, but not Amidah.
Note also that there are a couple of sources that seem to tie this phrase into Aveilus (See Sefer Halachos Ketzuvos from the Geonim Section Nehigas Haavel), which might also be motivation for attaching it to Kaddish, depending on when the connection between the two was made.
The "general approach" is the one given in Maseches Derech Eretz Perek Hashalom (Mishna 19), which says that all Berachos end in Shalom, and this was one of the common phrases, a short prayer which could end a paragraph.
אמר ר' יהושע דסכנין בשם ר' לוי גדול השלום, שכל הברכות והתפלות חותמין בשלום, קרית שמע חותמה בשלום, ופרוס סוכת שלומך, ברכת כהנים חותמה בשלום, שנאמר וישם לך שלום, וכל הברכות חותמין בשלום, עושה שלום במרומיו.