Mind Drama From Chronic Pain

I suffer from dull pain on a daily basis and the pain usually affects me mentally. My doctors told me that a racing mind is a result of the chronic pain. It’s how our brain tries to justify the sensation it’s picking up in the body and then it starts to come up with stories to align with the experience. The only thing that can be done is mind management. When I catch my mind racing without any particular trigger I try to check in with my body and once I find the dull pain, my brain immediately drops the spiraling thoughts and I’m back to neutral. The problem is that after years of dealing with this, I see that it takes a while for me to realize this could be caused by pain and I don’t know if theres anything more I can do to help my mind. (The spirals just show up.) One thing I’ve noticed is that the feeling is usually sadness or an emotion that’s close to sadness. Is this how my body and mind are trying to talk to me, is it a compassion thing or is it just something where every time I spiral I need to practice going into my body? Thanks!