In Sefer Devarim 4:20 it says:
וְאֶתְכֶם֙ לָקַ֣ח יְהוָ֔ה וַיּוֹצִ֥א אֶתְכֶ֛ם מִכּ֥וּר הַבַּרְזֶ֖ל מִמִּצְרָ֑יִם לִהְי֥וֹת ל֛וֹ לְעַ֥ם נַחֲלָ֖ה כַּיּ֥וֹם הַזֶּֽה׃
but you יהוה took and brought out of Egypt, that iron blast furnace, to be God’s very own people, as is now the case.
מכור. כּוּר הוּא כְלִי שֶׁמְּזַקְּקִים בּוֹ אֶת הַזָּהָב:
מכור — a כור is a vessel in which one refines gold.
Based on the Torah's description of Mitzrayim as being a kur habarzel (and other sources, I assume), Rav Yaakov mi'Lisah explains in his hagaddah (Haggadah Maaseh Nissim, d"h מתחילה עובדי עבודה זרה היו אבותינו) that galus Mitzrayim was necessary, and in fact a chessed, for the Jewish nation. Since the nation was born from people who worshipped avodah zarah (and because of the sin of Adam haRishon) there was an inbuilt filth (זוהמא) which needed to be purified and purged. Galus Mitzrayim was this "iron blast furnace" which purified the nation. This purification was necessary because without it, the nation would not be on a high enough level to receive the Land of Israel (or the Torah or Olam Habbah).
My first question is: How exactly was this purification supposed to take place? What were the mechanics of galus Mitzrayim removing the national "zuhama" of our ancestral worship of avodah zarah?
My second question is: Did this purification actually take place? We find midrashim which say that at the time of kriyas Yam Suf the Jews and Egyptians were BOTH worshippers of avodah zarah! (עיין שמו"ר כא, ז זוה"ק ח"ב קע, ב ,ילקוט שמות רלד) How could it be that the "zuhama" was purged and yet the Jews themselves were worshipping avodah zarah?