The damage taken from casting a spell is received when that spell finishes casting but before the spell takes effect.
When Backfire's damage would be lethal, AI casters will often cancel a spell just before it would finish casting. Since the spell is immediately available they may cast it again, then cancel again. High cost spells can cause a drastic drop in energy.
The game's AI will only use this skill on targets wielding caster weapons. Switching to a melee weapon can be useful to avoid being targeted by it.