It may be as simple as the ghoul is a conduit for the magic its creator imbues upon it. In the story the ghoul has absolutely no control over the magic, it just triggers when it does things that ghouls do, because the lich or whoever designed the magic to trigger when those things happen...