I've noticed on TBC (Warmane) the above mentioned method breaks after a while and only keeps casting on enemies (with heals, that means you automatically cast on yourself instead of focus).
Not using any addons and a "/reload" fixes this. I suppose this has to do with Warmane's Anti-Cheat measure or your protection against it.
I cannot 100% reliably reproduce this and one user has reported that /reload does not fix this bug for him. Maybe when you hook CastSpellByName to prevent anti-cheat, you forgot to pass all argments to the hooked function and only use the first one?