I would figure the reason was because calculating it based on your inventory every time it's needed would've been expensive, so the developers decided to cache it, but instead of recalculating it from scratch when there's a stat change, they decided to try updating it incrementally, but I guess also imperatively. A string of mistakes has to happen to lead to such a situation but it doesn't seem super unnatural to me.
I wonder if it was percentage based. That'd be one of the easiest mistakes to make.
- Player has a stat of 100
- Wears "+10%" helm
- Player has a stat of 110
- Removes helm, game subtracts 10%
- Player has a stat of 99
Actually, now that I think about it more, that wouldn't work as described above because once your stat got close to zero you'd enter a kind of Zeno's Paradox situation.