Is there a source in Judaism that indicates that Moshiach (Ben David, not Ben Yosef) will die before having fulfilled his role and then return to posthumously achieve it?
In The Yerushalmi Brachos daf 17:1 (see Eicha Rabbah 1:51 as well ) says : The Rabbanan said if Mashiach is from the living David is his name, if he is from the dead, David is his name,
R' Tanchuma says the reason is based off Tehillim 18:51.
Rabbi Yehoshua ben Levi said his name is Tzemach.
Rabbi Yuden ben R' Aivo said his name is Menachem.
However, it is brought that Mashiach(kingship) will come from Shlomo Hamelech(Rambam Mitzvah Lo Taseh 362 ) ,and it is also brought down that the soul of Mashiach will be from that of Moshe( Ohr Hachaim 49:11 ) Meaning the soul of Mashiach is from great people not necessarily that these people are Resurrected.
אמר רב אי מן חייא הוא כגון רבינו הקדוש אי מן מתיא הוא כגון דניאל איש חמודות
Said Rav: If he [Mashiach] is from the living, he is like our great teacher [R' Yehuda HaNasi]. If he is from the dead, he is like Daniel, greatly beloved man [i.e. the Biblical Daniel].
Multiple sources say that the Moshiach will be hidden for some time, and come back and be revealed
Rashi on Daniel 12:12 says
Moshiach will be revealed, concealed, and then revealed again
Also Midrash Rabba Bamidbar 11:3
Rabbi Berachia in the name of Rabbi Levi said: Just like the first redeemer, Moshe, revealed himself to the Jews and then concealed himself, similarly the final redeemer will reveal himself and then conceal himself, and then return and reveal himself again
not exactly as you are asking. There is no source that someone proclaimed to be moshiach vadai can die and then come back to complete their mission as moshiach. There is a notion that moshiach may be someone who has passed away. The gemara quoted from Sanhedrin 98b does show someone who has passed away may be resurrected in order to be moshiach. This should explain to you the distinction between someone being moshaich, dying, and then coming back (not valid)versus someone who has passed away being the moshiach (valid).