TL;DR Thinking of quitting my PhD; Don't want to because of the perception that I'd be closing some doors on my future, but in my heart of hearts I know it's probably in my best interest to do so for my health.
Before I get into it, I would like to note that I am receiving professional help. I'm writing this post in hopes of getting clarity from those who have maybe seen similar circumstances.
For context, I moved from the US to a certain Southeast Asian city-state to begin a PhD in computer science, of which I am only in my first term. I like what I'm doing, I enjoy research for the prospect of proposing new knowledge, and I am certain that this career path is a good fit for me over the software engineering work I've done before. My goal is to work in industry, but in a research position (i.e. OpenAI or something similar).
The problem I'm facing now is that basically everything I'm experiencing outside of my program makes me feel somewhere between unhappy and severely depressed. Even after the initial bouts of homesickness that have since subsided, I have been thinking constantly about quitting the program for my own safety. In recent weeks I have had to come to terms with the fact that I suffer from severe mental illness which may kill me if I do not prioritize it. The Covid-19 pandemic has been especially unkind to my mental health, which combined with some issues in my interpersonal life and the shock of expatriating alone has come to a head with a diagnosis of major depressive disorder and a few suicidal episodes. I am receiving treatment, though I don't think it has been long enough for me to make a clear-headed decision about it, and I am seriously concerned for my mental and physical well-being. Taking a 6-month leave of absence is possible for me under the terms of my funding, but I have a gut feeling that I may not be equipped --now or ever-- to live so far from my family. Maybe it's culture shock, maybe it's the pandemic restrictions, that may only be clear in hindsight, but right now I can't picture myself surviving the entire four years abroad.
That said, I worked really, really hard for what I imagined was the only opportunity to enter this field, and worry that by quitting I'll essentially be shutting that door permanently. As myopic as that may be, I have read quite a few accounts (mostly on Quora) of people saying that quitting here would make it nearly impossible to justify to another admissions committee that I can perform the task. I know if it even is possible I'd have to take enough time to stabilize my mental health first, but what I'm hoping is that it would be reasonable to go industry/concurrent masters > PhD or industry/concurrent PhD if/when I am ready. It is probably also worth noting here that my study habits have suffered from the things listed above; while my term is not over yet, my current academic standing is looking rather poor.
I tend to muddle my own questions with too much context, so I suppose what I'm really asking is if there is a path back to a PhD if I were to quit here. Are mental health concerns a sufficient justification for failing the first time? Do I address this failed attempt when applying again (my suspicion is yes)? I have seen people suggest to others who were further along or suffering physical health concerns to try postponing their defense or taking leave, however, I don't know how long it will take me to find the stability to pursue this again, and likely never so far from home. I also know that PhD students are expected to be able to handle personal stresses and outside factors alongside the degree, so it seems like mental health isn't viewed as such a significant barrier, but there seems to be a rising attitude that we should treat mental illness the same as regular chronic illness.
Anyways, thank you internet strangers for reading this. I appreciate any insight into my situation and future prospects.