If I'm honest, I don't necessarily believe DP/DR is caused by either. Having a chemical imbalance, is such a simplified view, of a topic which is incredibly complex and one in which our current knowledge is lacking. We still don't completely understand the cause of depression and/or anxiety disorders (never mind DP). I'll elaborate below:
Depression is often considered to be caused by a lack of serotonin in the brain. However, serotonin is just one of many neurotransmitters in the brain, and it is extremely difficult to measure serotonin levels in the brain (see link below, which shows that its measurement is still in its infancy and we don't fully understand what the measurements translate to). Let's just stay on the topic of serotonin. This simplified model, doesn't factor in the difference between raising serotonin in one brain region vs raising it another. We assume that the brain is deficient in a certain neurotransmitter and if we raise serotonin via SSRI's or serotonin precursors, we may receive the desired effect. However, perhaps raising serotonin in the wrong region of the brain, actually makes us feel worse. The article below also discusses how SSRI's raise serotonin in some regions strongly, but not so much in others. Lastly, this serotonin model doesn't factor in the importance of serotonin receptors and how they could differ in sensitivity, as ultimately they will be as important as the level of serotonin in the brain.
http://news.mit.edu/2016/mapping-serotonin-dynamics-living-brain-1020
In terms of overthinking, it's true that thinking negatively and feeling certain emotions can begin to impact the brain over time. Conversely, researchers have found that stress management techniques such as meditation reduce the size of the amygdala in the brain, and I believe also increases the size of the hippocampus. However, if I think back to when DP/DR was a huge struggle for me (I currently rarely experience DP/DR and wouldn't consider it a symptom or bother), I could NOT stop overthinking. However, after 4 days of supplements a magnesium based supplement, I didn't have DP/DR and I didn't overthink anymore. Once it's gone, it all stops. The overthinking usually begins because of how you feel, and once the feelings end, so does the overthinking. Definitely a case of 'the chicken or the egg'?