Change switch/variable/gold when skill is learned

Trying to make a skill tree (using FTRK_SkillTreeSystem), that not only works for learning actual skills, but for misc upgrades and such aswell, which should work via switches. So I'm making dummy skills, that giving yanfly's passive states, that should change switches the moment they are applied i.e. skill learned (probably totally wrong way to do that, but I couldn't come up with anyway else).

<Custom Apply Effect>
$gameSwitches.setValue($gameVariables.value(25), true);
</Custom Apply Effect>

Anyway it's not working. Either because it's out of battle or passive states are not actually "applied" at all.

Is there is more conventional way to check and do something when skill is learned? I don't think I should use parralel events just for that.
The latter. Passive states aren't considered applied, so they don't run Custom Apply Effects.
I think @ATT_Turan has a modification that will run apply effects even on passive states.

Alternatively I also have a lil plugin that lets you directly execute some javascript when a skill is learnt.

Original thread: https://forums.rpgmakerweb.com/threads/change-switch-variable-gold-when-skill-is-learned.167118/