There are several posts on this site about potentially leaving a PhD program due to mental health issues (e.g. 1, 2, 3), and these issues can impede productivity. Seeking help from a mental health professional can help immensely, though progress on the mental health front may take time. Depending on when they seek help and how long it takes to get better (and if they choose to remain in the program), they might experience years of low productivity. I imagine this can affect job prospects in industry and academia upon graduation.
One option is to leave the program and reapply when one's mental health improves. This post talks about prolonging a PhD to improve to improve one's CV. Assuming one's mental health improves, does it make sense to prolong a PhD to make up for periods of low-productivity caused by poor mental health?
Another possibility is to graduate, land a research job, and improve your research CV there. By asking the above question, I'm implicitly assuming that one's research output during their PhD affects their career trajectory more than one's research output in their first job. Is this accurate?
Edit: Here's a more concise phrasing of my question. Suppose one hopes to get an industry research job X upon graduation and needs a more competitive research CV to get job X. Is it preferable to (1) extend the PhD to build one's CV, or should one (2) take a different research job Y, build their research CV there, and then try to jump to job X?