I tried this for science and I discovered the best way to utilize these UnitIds is to do a little trick which allows for forced interaction with a soft target to a degree. Basically instead of using anyenemy in the cast line which will not work to force enemy interaction with those hybrid spells still you can simply force wow to take the target of your soft target with /target [@anyenemy].
#showtooltip
/target [@anyenemy]
/cast Holy Shock
I only tested with holy shock but I imagine that should work with Penance and Living Flame. I do not believe it is possible to keep an ally/self targeted and cast on the soft enemy target with these spells but this allows a workaround so it at least functions with action targeting.
Just in case anyone comes upon this it will only work with action targeting enabled you cannot use these UnitIds to interact with anyone without it enabled.