Clearly all of these Sages were suggesting the names of their teachers as potential candidates to be the Messiah – something that we find regarding the names of other Sages in different midrashim, as well. This is, apparently, based on the continuation of the Gemara where it is taught that in every generation there are individuals who are worthy of being the Messiah, but because the time has not yet come he cannot be crowned as such. The students sitting in the various study halls each saw their own Rabbi as being the one most likely to play that role in that generation.
The Gra suggests that the names listed in the Gemara form an acrostic –
whose opening letters spell out “Mashi’aḥ.”
Rav Naḥman is quoted as saying that if the Messiah was someone who was living in his generation, then he – Rav Naḥman himself – would be the obvious candidate. The passage that he refers to in order to support his claim appears in Sefer Yirmiyahu (30:21) where we learn that it is someone already in a leadership position who will be the mashi’aḥ, and Rav Naḥman filled that role.
Even in later generations it was not uncommon to find Jewish leaders who hinted in their writings to the possibility that they were worthy of bringing the redemption, something that was, on occasion, taken very seriously by their students.