When a game designer writes a game system that allows things to be added in any order, and writes the rules so that the order doesn't matter, letting users change their mind all they want during character/NPC creation, and then writes one or two items whose rules work like this, where the order the character aquired them matters, is when I want to throw things at them. I hate non-retroactive changes.
An absolutely correct handling of this sort of thing would require EVERYTHING on your character to be tracked by the order it was added in - meaning if you were creating a 10th level NPC, and you decided to change your mind about whether to take class X at 3rd level, then class Y at 4th, or to reverse that, you'd need to delete every feat, purchased item, class level, etc. added after 4rd level, then put it all back after making your change. Then, you could track that all the class levels this character gains after aquiring the template are affected by the INT penalty but the racial and class levels aquired before are not.