What is the History of Tachanun / Aleinu having been written (originally)?
Tachanun is considered an extension of Shemona Esrei, as the gemorah says that we daven to Hashem standing then prostrated (tachanun) and then sitting. Then we get up and “vanachnu lo neida me naaseh” we don’t know what ( more ) to do. Meaning that it is a way of expressing to Hashem that “we are davening in every possible fashion”, and please heed to our tefilloh.
Aleinu was written by Yehoshua Ben Nun after the Jews entered Eretz Yisroel during the siege on Yericho. It was said seven times and then the wall of Yericho sunk into the ground. The Rash of Garmiza writes that it has 152 words in it like the gematria of בן נן=152. Additionally Yehoshua was a descendant of Yosef, who was termed שור, and the gematria of שור is that same as עלינו לשבח (It is really one off but in gematrias that is acceptable.) after the destruction of the Bais Hamikdash, R’Yochanan Ben Zakai instituted that it be said every day.
Kol Bo 16, Ramak -Seder Gerushin pg. 109, Machzik Bracha O:CH 132 Morah Betzba 35, O:CH 131.