The probably would work. Be interesting if someone would make a small, portable one you could carry in a holster.
But other effects make it problematical.
A hot loaded .357 or .44, or.460 or .500 magnum puts out a pretty good flame, when fired.
I’m just thinking, bears don’t understand bullets, they probably don’t understand pepper spray, but if they live in a forest they surely understand fire... makes the threat plain as day to them.