You’re describing situational depression. A lot of people have chronic depression, where he only hope for managing the depression involves pharmaceuticals.
Drugs like MDMA are being evaluated as a potential treatment as well: https://www.medicalnewstoday.com/articles/mdma-depression
Anecdotally, I've heard it usually takes several tries to find an antidepressant that works for any given patient. But once you've found a drug that works, that helps a lot.
It could as easily not stem from it.