This is because it isn’t the pudding or the liquor that is on fire: it is in fact the vapour associated with the alcohol that burns. The flame never actually reaches the pudding itself.
To set a Christmas pudding alight, the liquor must be warmed beforehand - otherwise there will be no vapour to ignite. Once burning, the heat generated warms the liquid alcohol in the pudding, creating more vapour until eventually there is no more alcohol left to vapourise. At this point, the flame burns out and the pudding is left tasty and un-charred. And you hopefully won’t have burnt the house down.