Adding passive skills to Yanfly's Class System/Skill Learning that only work when class/subclass act

So after a bit of messing around, I've come across a slightly modified version of Yanfly's Passive States script that enables Passive States on skills. The problem however, is that due to how skills work in Yanfly's setup (they're still considered learnt when you aren't using an appropriate class, they just don't populate your skill list so you can't use them), the passive skills remain in effect even if a class that lacks said skill is in use. Let me try a more practical explanation to help things along though.

In this example we have a class called Soldier. It can learn a Passive Skill called HP+10%, which does exactly that. It boosts maximum HP by 10% The problem is that if you switch off the Soldier class and it is set as neither a primary or subclass in yanfly's system, the passive skill's 10% is still effective because the character technically hasn't lost the skill, it's just not generated on the skill list anymore.

What I basically want to do is set it up so that I can have passive states via skills (I can post the modified passive states script if needed for reference) but ONLY have those passive skills/states apply if the appropriate class is in use as a primary class or subclass.
I think you should post the modified passive states script that you used so people can help you better.

Original thread: https://forums.rpgmakerweb.com/threads/adding-passive-skills-to-yanflys-class-system-skill-learning-that-only-work-when-class-subclass-act.44031/