The days of Mashiach and the Resurrection of the dead are not the same events. The building of the Holy Temple would be first, then the gathering of the children of Israel from exile. The last event would be the Resurrection as we read in the following verses;
“בּוֹנֵה יְרוּשָׁלַם יְהוָה נִדְחֵי יִשְׂרָאֵל יְכַנֵּס.”
“הָרֹפֵא לִשְׁבוּרֵי לֵב וּמְחַבֵּשׁ לְעַצְּבוֹתָם.”
“YHVH builds up Jerusalem; He gathers the outcasts of Israel.”
“He heals the brokenhearted And binds up their wounds.”
‘builds up Jerusalem’ – Building the Holy Temple.
‘He gathers the outcasts of Israel’ – Gathering the Israelites from all corners of the world.
‘heals the brokenhearted And binds up their wounds’ – The Resurrection of the dead that will heal the broken hearts of those who experienced the pain of death.
The Resurrection will be 40 years after the gathering of the Israelites. During this time, there will be chaos and wars on the Israelites but some would escape this chaos.
“וּבָעֵת הַהִיא יַעֲמֹד מִיכָאֵל הַשַּׂר הַגָּדוֹל הָעֹמֵד עַל בְּנֵי עַמֶּךָ וְהָיְתָה עֵת צָרָה אֲשֶׁר לֹא נִהְיְתָה מִהְיוֹת גּוֹי עַד הָעֵת הַהִיא וּבָעֵת הַהִיא יִמָּלֵט עַמְּךָ כָּל הַנִּמְצָא כָּתוּב בַּסֵּפֶר.”
“Now at that time Michael, the great minister who stands guard over the sons of your people, will arise. And there will be a time of distress such as never occurred since there was a nation until that time; and at that time your people, everyone who is found written in the book, will be rescued.”
The Archangel Michael is the protector of Israel. He will protect those who will be found written in the book that lists those with the merits to be alive at that time.
Rabbi Yehuda says that all will go through a process that will help the people to remove their negativity. It is described in Zechariah 13:9
“וְהֵבֵאתִי אֶת הַשְּׁלִשִׁית בָּאֵשׁ וּצְרַפְתִּים כִּצְרֹף אֶת הַכֶּסֶף וּבְחַנְתִּים כִּבְחֹן אֶת הַזָּהָב הוּא יִקְרָא בִשְׁמִי וַאֲנִי אֶעֱנֶה אֹתוֹ אָמַרְתִּי עַמִּי הוּא וְהוּא יֹאמַר יְהוָה אֱלֹהָי.”
“And I will bring the third part through the fire, Refine them as silver is refined, And test them as gold is tested. They will call on My name, And I will answer them; I will say, ‘They are My people,’ And they will say, ‘YHVH is my God.'”
As we learn from this Zohar, the Final Redemption is not a quick process. After the revelation of Mashiach, there will be wars in the world and many will die. In Zechariah 13:8 it says “פִּי-שְׁנַיִם בָּהּ, יִכָּרְתוּ יִגְוָעוּ; וְהַשְּׁלִשִׁית, יִוָּתֶר בָּהּ” “”It will come about in all the land,” Declares YHVH, “That two parts in it will be cut off and perish, But the third will be left in it.”
The third would still go through a cleansing process to remove any leftover negativity that they may have. It’s done to purify them and have the merit for the Resurrection.
The Zohar also quotes Ecclesiastes 12:1 saying “Remember also thy Creators in the days of thy youth, While that the evil days come not, Nor the years have arrived, that thou sayest, ‘I have no pleasure in them.’”
The lesson is that at the end of days before the Final Peace, there will be a period of suffering and pain that we would wish not to have.
Two sages in the Talmud say that they wish for Mashiach to come but not to see it. They knew that his coming would be accompanied by horrible wars and chaos in the process of removing the negative and evil from the world.
Our work and studies earn us the merit to be registered in ‘the book’. The merits and purity we achieve in this life save us a lot of pain in the future.