It is brought in Kol HaTor that Moshiach ben Yosef and Moshiach ben David are hidden, as long as Am Yisrael and the Shechinah are in Galus.
This indeed has been the case during history.
As mentioned before, the main tasks of Moshiach ben Yosef are:
- Kibbutz Galuyot
- Binyan Yerushalayim
- Setting up Anshei Amanah (the precursor to the Sanhedrin)
- Revealing the Secrets of Torah
The Ariza"l and the GR"A, both identified in the role of Moshiach ben Yosef, revealed many secrets of Torah. The GR"A sent his students to start the work of Moshiach ben Yosef. But what about afterwards?
We find that the person who is credited as the father of Zionism is Theodore Herzl, a secular Jew. The First Zionist Congress in Basel, 1897, which was initiated and chaired by Herzl, was a pivotal event in the history of Zionism. Rav Kook referred to him as Moshiach ben Yosef (if anyone can supply an exact source for that, I would appreciate).
How can we consider Theodore Herzl as one of the many incarnations of Moshiach ben Yosef? He did not keep Torah and mitzvot; his life story is public knowledge for one that wants details.
That is exactly the key: Since Am Yisrael and the Shechinah were still in Galus, and the appointed time had come to arouse Am Yisrael to make Aliyah, the Moshiach ben Yosef who came forth had to be someone who did not fit the mold.
This also teaches another idea: the revelation of Moshiach is dependent on Am Yisrael returning to Eretz Yisrael.