Two potential difficulties must be checked:
- Whether the amount of released water vapour suffices to extinguish the fire
- Whether the sugar itself burns. Sucrose for instance does, in the presence of ash.
What about a water gel? It contains mostly water, and heat could destroy a well chosen one, releasing the water. If destroyed under 100°C, the released liquid water may drop to the bottom and be less efficient, but if you find a gel destroyed above +100°C, it will release vapour.
As a child I had mixed sodium bicarbonate in epoxy to protect rocket walls from fire. It worked more or less: the released CO2 visibly blew the flame away from the wall.
You could also use a foam inflated by a fire-extinguishing gas. The released amount is smaller, but some bromine-containing gases are efficient.