Thanks for pointing this out @[MCQA] v-weszaj, I can confirm this works indeed when done correctly.
A complete example pack for this process on the official github page or in the Documentation would be very helpful tho.
I have updated my original post and uploaded a behavior Pack.
Addition to this issue:
If a player first has op status and the ability mayfly is true (he can fly right now),
and then the op status gets removed the player can't stop flying.
This bug also affects version 1.21.30 and 1.21.31