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.
Attachments
Comments

[media]

Can confirm in 1.17

Affects 1.17.1
Can confirm in 1.18.2 and 22w14a, though it appears in my testing that zombies don't try to pathfind to water when burning, regardless of the time of day.