Choni Hamagil prayed for his own demise and died. Is it permitted to pray for ones death?... Did the temporary social problems of Choni justify a suicidal prayer?
Regarding Choni ha'Me'agel, he was suffering greatly from his circumstances, even though he was not physically ill.... It is not clear that the problems of Choni were temporary, as you wrote. In the case of Choni ha'Ma'agil and Rebbi Yochanan... those who Davened were on a high enough level that they recognized what was best for them, and they Davened accordingly, and Hash-m agreed with them and fulfilled their requests. (Also, it does not actually say that they Davened to die. Rather, it says that they "prayed for mercy (Ba'i Rachmi) and then they died....")
Kollel Iyun Hadaf
(a) Your second answer is unacceptable in light of the edition of the Ein Yaakov which reads "he prayed for mercy TO DIE and then he died".
(b) Your first approach is difficult as it is hard for us to comprehend why Choni's predicament was so futile. Certainly, he could of proven his self-worth to them given some time. The same way that Choni built a reputation the first time, he could do so again. Furthermore, many of our greatest scholars, such as the Vilna Gaon, purposely exiled themeselves to places where the populace would not recognize their wisdom. Why was Choni worse off than they?
(a) Of course according to the texts which have the Girsa that he prayed to die, my second suggestion does not apply, and that is why I wrote it only as a speculation. (By the way, as the story is recorded in the Yalkut and in the Dikdukei Sofrim, the Girsa is as it appears in our Gemara.)
(b) You are correct that it is hard for us to comprehend why Choni's situation was so futile. But our inability to comprehend it does not detract from the futility of his situation. And it is not at all clear, as you assert, that he could have built up his reputation again, given some time. In fact, the Acharonim say clearly that his situation was futile, and that, due to the fact that a new generation had come into the world and the environment of Torah learning had changed (Yeridas ha'Doros), he would not have been able to convince them of his identity no matter how hard he tried. (See Maharsha, Sichos Reb Chaim 5731 #19, Michtav m'Eliyahu 4:208.)
Regarding your comparison to other Gedolim who exiled themselves, there is quite a difference between anonymity that is chosen and anonymity that is forced.
Also, Choni did not actually kill himself. That would certainly have been forbidden. It is not forbidden to Daven for what one wants, and even if it seems morally incorrect to Daven to die, someone on his level of awareness of Hash-m was certainly in touch with the proper things that he should Daven for. (Also, see TOSFOS in Shabbos (50b, DH b'Shvil Tza'aro), who writes "Ein Tza'ar Gadol m'Zeh" with regard to an emotional Tza'ar.) Indeed, your question could be asked about Nachum Ish Gam Zu (Daf 21a), who Davened that his limbs be severed and his eyes blinded. The similar answer applies there, too. He was on a high enough level that he recognized that this was the preferably path of atonement for him, and thus he Davened for it.
Finally, I saw some Acharonim (see, for example, Ben Yehoyada), who says that the entire incident recorded in the Gemara about Choni ha'Me'agel was a dream. If so, then your question is certainly answered.
All the best,
I believe that there is a Teshuva from R.Fleckeles (Teshuva M'Ahava) that permits praying for someone to relieve severe suffering as the Amsa D'Rebi did in the end of Kesuvos.