I've had this shit happen to me too.
A few days after I took MDMA, I smoked some weed and I had some sort of a flashback from MDMA. My body was suddenly weightless, moving was efortless, colours were brighter, the world looked like a fairytale and I freaked out.
But then I convinced myself that these things are normal, the flashbacks, especially on some strong weed. So just go with it, don't fight it.
Your problem is worse, though. Because an MDMA experience is a very intense and emotional one, your panick attack has been burned in your memory (serotonin plays a major role in memory, memories are linked to emotions - For example, when you smell something you haven't smelled in a while (like the fresh smell of spring), or you hear a song you haven't heard in a while / especially if your past experience with these smells/songs were happy experiences - you are immediately transported to the state of mind you had when you first heard that song/smelled the smell).
The same thing is happening with your panick attack. Because the bad experiences are now burned in your memory because of your very high serotonin during the MDMA trip, any small thing/trigger that could possibly remind you of your horrible MDMA trip will bring back a flashback/panick attack.
I had the same thing as you. But not on MDMA. I took something like MDPV or something nasty like that. I ended up in the hospital because my heart was at 180BPM (I was having a panick attack, the HR wasn't because of the MDPV). I honestly thought I would die that day.
It was a very traumatic experience and I felt the after-effects of it for 6 months after. I had super-anxiety with anything related to my heart beating fast. Like if I would run up some stairs and notice my heart beating faster (which is normal) I'd start to freak out just a bit, reliving the hell from the day I ended up in a hospital when my heart was beating so fast I was sure it would explode.
Smoking weed made it so much worse, I was paranoid about everything and I constantly thought the weed I was smoking was laced with MDPV.
I had some social anxiety... It wasn't that I wasn't social. I was always a very social person, and I still am. Only that after the MDPV episode, whenever I was with people I didn't know, my heart would beat really fast for a long time, and I would feel a bit nervous and overly-stimulated.
What I did was face my fears, I kept on going to school/going out/doing other stuff that may have caused me anxiety... and with time it subsided.
Now, after about 6 months or so, I am back to normal... The confident motherfucker I've been since before I started using drugs... If I think about it, I'm even more confident and have bigger self-esteem. Maybe it's because I proved to myself that I can overcome my fears
I wish you all the best, I hope that you solve your problem.
Remember, don't lose hope, and have patience... It takes time for your brain to heal itself.
Also, try meditating on the issue and convince yourself there is nothing to be afraid/anxious of. If you do this every day, I can guarantee a result.
About the doctor: I don't know how he could help you. Maybe you should go to a psychiatrist and seek therapy.
What the doctor might or might not do (because you're a drug user), is give you are benzos for your panick attacks. But trust me when I say that benzos are NOT the sollution. Sure, they're a godsend at first, you will feel like you got your anxiety-free life back. But that will only work for the first month. After that you will have to increase the dosage as tollerance builds fast. So more and more, until it will fuck your brain so much, that you will get extremely bad withdrawals when/if you try to quit. You will have even worse anxiety than you had before starting to take them. You'll get addicted to them.
Unless you want to be on benzos for the rest of your life, they are not really the solution for your anxiety.
I'm not saying don't use benzos. They're great. But don't use them more than twice a week or else it's pretty bad. If you're going to use them, try and use them in a situation you feel you will get the most anxiety: Like talking in public or something like that.
The best way to heal yourself is what I've described above and have done myself.