You can write a self canceling conditional buff. I've written a few of them already.
For a nice, clean passive, you need four buff files, spawner, disruption, disruption check and effect.
All buffs should be PrioritizeOldBuffs.
In the spawner buff, do your application method. This will work for radius effect abilities, targeted, self targeted, the works. I suggest a periodic in the 5 second interval range. Identical for the two buffs, disruption and check.
The disruption buff just needs to remove the check.
instantAction
buffInstantActionType "RemoveBuffOfType"
instantActionTriggerType "OnDamageTaken"
delayTime 0.000000
buffTypeToRemove "BuffWhatever"
Duplicate this action with the OnWeaponFired trigger and set it to 1.00000 chance for all weapons.
BuffWhatever, the check, is a simple OnDelay ApplyBuffToSelf of the effect. It needs to be at least a second to avoid slow computers firing it off before it gets canceled properly just for a base time, so factor that addition into how long it needs to be to catch incoming and outgoing fire before it goes off. You can use longer than needed delays to create a cooldown period after combat ends as well.
Then, in your effect file you just make the finish condition be LastSpawnerNoLongerHasBuff "BuffWhatever".
You now have a nice, clean, self removing buff.
Edit: If you're trying to set up an end effect that needs to be reapplied to work, you've got a more complicated situation and will need to alter your timing properly in order to set check and effect to both be PrioritizeNewBuffs without replacing the check before it fires.