And by studying how they work we learn about how pain works. Compare to alternative, "keep smiling and find better friends". Fuck that. Even if it was relevant (it probably isn't), I can't smile or talk to people, because I'm constantly in agony because of my arm. I'll stick to opiates because they let me live.
The point in the analogy though is, the pain is a symptom. Understanding how pain is transmitted through nerves and how to block it is certainly useful in the treatment of broken bones, but far more important is understanding that the pain is caused by the broken bone. The pain itself is not the problem, even if makes sense to ameliorate; focusing on the pain instead of the break can lead you to masking and failing to treat the underlying problem, allowing it to worsen.
Yeah, I get the point of the analogy, but I think in reality, the "social" approaches to solving depression are closer to curing broken bones by telling patients to change friends / sleep more / find God. And I say this as a person who had depression and anxiety issues for a long time. Yes, some parts of it are affected by my life conditions, but sadly I can't wish my way out of sudden, random anxiety attacks.