It definatly is not possible. JASS is the trigger scripting language WC3 uses so is not super powerful like many people think.
An idea occured to me. You could keep track of cooldown using timers. When the ability is used, you start a timer with a timeout of the abiliti's cooldown. You then make a system to keep track of ability removal and addition. If the ability is removed before the cooldown timer (the one started when cast) finishes, then it can not be added until the timer expires (which signifies the ability has cooled down). This could be done by abstracting the add and remove process where it can only give the unit the ability if and when the cooldown timer expires otherwise until then it only virtually has it (a custom function returns the unit has the ability even though it physically does not).
This can be viewed as a form of proxy with caching functionality. Because the remove and add ability are heavyweight due to cooldown (can not remove and add without messing it up), the proxy gets interacted with which inturn manages ability removal and addition in such a way cooldown is consistent.
Be aware though that this could cause the ability to go missing for a length of time. This however is the only MUI way to do what you want.