When people experience a loss, they have several ways of dealing with it that are available to them. One is depression. People who choose that response are mostly the ones who feel guilty for the loss, so they punish themselves with pain and also use pain to maim themselves. Because if they don’t act, they can’t make another mistake that leads to loss. Obviously, loss is not the only thing that provokes depression. It’s just one of them.
Another response to loss is denying the loss or its significance. It’s not nearly as maladaptive as depression.
Yet another one is substitution of the object that was lost with a new object. By object I obviously mean whatever the ego attached to. When that object disappears (and it can be a person, a job, a feeling, etc), the ego is wounded. And depression, denial of significance and substitution are the available strategies to respond to this pain.
Of course, there’s always medication but I’m not talking about people who go for that method.