This is a trick your conscious mind learns at an early age as a short term safety stratergy, for dealing with high levels of physical or emotional pain.
After time these represed emotions and memories create there own mechanism for each individual depending on how often they are experienced, thats why everyone has different symptoms for the same type of disorder.
These mechanisms are basically personality neuroses developed to avoid the original situation happening again.
Its kind of like going into shock for something that happened a while ago when the mind connects something happening in the now to something traumatic that happened in the past at an early age and repressed.
When it happens at a later age and the memories are not fully repressed or you are partially aware of what is causing it, its called PTSD.
Memories and emotions can trigger hormones and other chemicals that affect our consciousness and the way we feel and experience personal reality.
The association of repressed emotions and events can be very losely connected to each other by the unconscious part of the mind which is a little primitive as it deals with the running of the body in the background.
Its like having windows 95 as an operating system on a computer with your added individual software programs for what you do on that computer but the unconscious mind is constantly learning making associations and adapting unlike computer operating systems.
So you may have emotional or memory associations created by the unconscious mind that appear completely irrational in there association but have the same chemical response which creates the emotional or physical response.
That original repressed event now triggers the dissociation from your present situation because it may be considered the same or similar to the repressed experience by the unconscious mind and needed to be avoided or at least emotionally supressed as much as possible again to protect your conscious mind.
For some people weed breaks down these barriers between conscious and unconscious mind, and it triggers a bleed over from one to another which may trigger the protective dissociation mechanism.
Edit. This is a very simplistic explanation as its early in the morning, its a lot more complex in its entirety.