I think you're onto it. If an organism is not successful in whatever circumstance, then it is for the benefit of the herd (and species) that the individual drop out and not propagate its genes further. It is a braking mechanism. A psychic-emotional watchdog.
I don't think that suicide (logicaly following from "not propagate its genes further") is an actual objective of depression. It is probably more about forcing an individual to think their problem through - that's what you do when you are depressed, constantly thinking about all the things that went wrong in your life.
Thing is, in primitive, savannah environment all problems were simple enough that they could be solved by just few hours/days of thinking and planning. Nowadays we live in civilized society which poses much bigger challenges, which cannot be easily fixed. That's why depression can extend to weeks/months, and after that time it becomes chronic condition, even when the actual problems that caused it has already gone away.
Yes, you think things through, but if you ultimately don't find a solution, you choose suicide.
(or maybe in old Savannah times, just lying aphatic around for ages maybe meant the same, with getting eaten by a lion)
But I would also argue, I that even in primitiv societies, things could get very complex - because their daily life involved also lots of deamons, spirits, ect. you had a bad dream, but that might mean that an enemy sorcerer tried to kill you and now you needed to figure out who and what to do against it ...
I think that is to one dimensional a view. Many organisms come into situations they are not really fit to survive- society is complex, there are lots of dark corners where specialisation is needed. If you are a social party animal and by inheritance suddenly have to become a 24/7 CEO of a company,without any breaks and non stop political power plays - depression is not indicating that you are unworthy or something. It indicates that you want to migrate in society, away from a unhealthy environment- you detach yourself from the people you have to deal with and wait for reattachment with a better crowd. Sort of the eject capsule from bad influence you do not want to adapt.