Would dimension door trigger or bypass mental prison?

After failing the saving throw for mental prison, the target is subjected, among other things, to this:

If the target is moved out of the illusion, makes a melee attack through it, or reaches any part of its body through it, the target takes 10d10 psychic damage, and the spell ends. (XGtE 161)

If, while under this effect, the target casts dimension door, what would happen? Would it count as being “moved out of the illusion” by the spell? Would the illusion, being in their head, follow them? Would this be different if someone else casts dimension door on them?