So I haven't figured out the fix yet, but I can say that the problem lies in this section:
src/battle_script_command.c
C#:
case VARIOUS_ABILITY_POPUP:
CreateAbilityPopUp(gActiveBattler, gBattleMons[gActiveBattler].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0);
break;
If you change the gActiveBattler in both points here to gBattlerTarget then it will display the correct ability for the wild or opposing pokémon depending on the ability type, for example:
I added Cursed Body, and when that triggers with the change I mentioned above it shows for the correct pokémon:
View attachment 166189 View attachment 166191
However an ability like Intimidate still shows for the wrong pokémon:
View attachment 166190
I'll keep looking into it, but my hypothesis is how the ability is triggered passes in the pokémon data in different ways.
If I figure it out I'll reply back but I thought I'd share my findings to see if this helps.