Burning undead mobs only attempt to pathfind towards water during the day. The source of fire doesn't matter. They never try to extinguish themselves during night.
MC-115396 claims that they never try, except they do. But only during the day. At night they act like nothing happened.
Can confirm in 1.17