I am unsure what would cause this problem, as in the last update I made it so that the optimization it does on the class change scene is an exact identical copy to the one it does on the equip scene when you hit the optimize command. That it is to say that it contains all of the changes made to the function called when the optimize command is used, including those from all other plugins, even ones I have no idea about.
Is it possible that there is something else going on here too? Since class changing is involved, is it possible that the items being removed are unequippable by the class you're switching into?
Another thought I have is that you mentioned that when this happens, the classes involved have different numbers of slots. Is it possible the cause is that the equipment slot with the unoptimized etype is moving when you change class?
Like, class A has the following slots:
weapon, shield, head, chest, pants, feet, accessory 1, accessory 2
And class B has the following slots:
weapon, head, chest, pants, feet, accessory 1, accessory 2
And you have accessories set to be non-optimized, but when you change classes from class a to class b, you lose slot 1 entirely, so everything has to move up a slot, and then because what used to be the feet slot is now accessory 1, it optimizes weird?
Or maybe another possible example, that two classes, a, and b, can both equip a specific etype, type 10 (as you said), but for class A, the slot for this item is the third thing down on the list (x, y, 10, z... etc) and class be it is the second thing down on the list (x, 10, y, z... etc). And because the slot is not the same, some other process has to move items in one slot to the other slot during that class change.
I really don't know here, I'm just grasping at straws, honestly. If you turn off optimization on class change entirely, and then swap classes, do you notice anything weird on the equip scene without optimizing? Like is there an item missing from a slot that shouldn't have been touched? As far I know, the default functionality is to leave equipment that can be equipped by the new class on the actor when they switch class. That might help narrow down where the problem is.