Rabbi Tzadok HaKohen of Lublin, in his work "Pri Tzadik" on Parashas Vayechi 1:5 explains:
The completion of Jacob's holiness is specifically in Egypt, and not in the land of Israel. This coincides with the notion that the revelation and arrival of the Jewish People which contains the souls which were prepared for the acceptance of the Torah specifically in a foreign land and not in Israel, and that the end of the creation of the world occurs in the land of Egypt. These concepts are closed(Satum) from human understanding. (emphasis mine)
In the beginning of his commentary on parashas Vayechi, the Pri Tzadik explains:
All the days of Jacob when he was in pain was not considered to be life because they were not completed in holiness (?) and only in Egypt did he merit to complete them in his holiness. Logic would dictate that since Israel is the place of greatest holiness in the world, as G-d told Abraham to leave Aram and go to the land of Israel, and Isaac was told that he would be blessed if he lived in this land. Jacob himself loved the land, and it would have been fitting for Jacob to complete his life in holiness in the holy land, and not in Egypt which is an impure land, and its people are more polluted than any other.
The Pri Tzadik already says that it might be hard to believe that Yaakov's holiness is specifically in Egypt and not in Eretz Yisrael, but he says that we also got the Torah outside of Eretz Yisrael and that during the exiles, the Torah expanded (Oral Torah). But this does not answer the question why only in Mitzrayim, a place of corruption (Rashi, Vayikra 18:3, cited in Hayom Yom, Teves 18), Yaakov was able to attain a higher level of holiness.
Are there mefarshim, contemporary or other, that explain why Yaakov needed to be in Mitzrayim in order to attain a higher level of holiness?