Water is just freaky because both parts are highly flammable.
That’s just a lack of understanding.
Burning is just oxidation. Oxygen is a reactive gas, right, so lots of things will react with it to produce oxides, and oxidation is often exothermic. If you get something hot enough it produces vapour, which being gaseous and on earth mixes with well with oxygen, and the heat generated by the rapid oxidation reaction can produce even more vapour which is heated by the previous reaction and it becomes self sustaining.
H2O and CO2 are both already oxides, in other words they are spent fuel. They can’t oxidise any more, so they can’t burn. They have low chemical potential because the reaction has already happened.
So then they wont’ burn, so you have to consider the other effects they have on an already existing fire. CO2 just displaces the oxygen in the immediate environment (whilst not burning), which stops the fire. H2O, being the funny stuff it is, has a huge latent heat of evaporation. So when you put it on something hot and it evaporates, it removes a lot of heat from that thing. Put enough water on something hot enough to burn and its temperature will drop enough for the oxidation reaction to stop.
I am not a chemist mind, so I’d be happy for someone else to supply more accurate details.