Historically, the bracha of Racheim has been adapted to the conditions of that particular time period. Under the rule of David Hamelech, it was a prayer for Hashem to bless klal Yisrael and Yerushalayim. Under Shlomo, “al habayis hagadol vehakadosh” was added, as well as a tefillah that malchus Beis David endure. This explains the order of the requests at the beginning of the bracha: for klal Yisrael, Tzion, Beis David, and the Beis Hamikdash. Later, in galus, these tefillos for endurance were changed to tefillos that they be restored.
Adapted from World of Prayer by Rabbi Elie Munk