I think sometimes it's very difficult to draw lines between what is caused by the pain we are in and what is depression and what is influencing what and which way it is going. Since the brain and the body are not in any way separate from one another, t here's really no way to distinguish or know for certain. Being in pain can mean not doing the things that might make a person feel better emotionally, like having a clean house or going outside for an activity or seeing friends, etc., increasing the probability of depression. And being depressed can mean the same things. And I think that being depressed can possibly also create pain in the body as well.
Although I have not had fibromyalgia or any other form of chronic pain all my life, I have been depressed for most of my life, and I am as sure as I can be without solid medical proof that this has contributed to my having fibromyalgia now. But of course, that leads one back to the roots of the depression, which are likely to be in personal trauma and generational trauma, as well as possibly genetic. So around it goes, what caused what. I suspect that if the human species manages to live long enough these things may eventually get parsed out, which could help a great deal with treatments, but it is not likely to happen in my lifetime.