Well, stumbled across multiple things here.
First, the effects index correction should also check, that its not correcting the current ability.
Change
OR ((___#1effect_index == ___#abil_fx_idx) AND (___#abil_fx_num == 1)) BEGIN
to something like
OR ((___#1effect_index == ___#abil_fx_idx)
AND (___#abil_fx_num == 1)
AND (___#index2 != ___#index1)) BEGIN
And second, I don't think it's a good idea to initialize the effects index in the new abilities with 0.
If I remember correctly, the engine is expecting a special order of the effects (at least on Macintosh).
First global effects, then all the effects in the order of the abilities.
In fact, I believe Near Infinity is currently disregarding the effects index in the abilities and just reads them as they are in the file. (Only using the effects number to attach them to abilities.)
Not sure, if this is a bug or intended. (Can anyone clarify/confirm this?)
So it would be better to set it to the currently last index + 1. (You would have to write some code to find that index.)