Much like how Vecna escaped to Sigil, it was a loophole - Vecna had created a powerful avatar, a significant commitment of his divine powers explicitly intended to exist in mortal form, with the intent of using it as part of a ritual to launch himself to greater godhood. This hubris and negligence created something the Dark Powers could grab onto, and because Vecna had anchored his existence to this avatar, when they used it as the hook to pull him in, the rest of him went along for the ride.