With the development of relativity it became clear that mass and energy are the same, and therefore that they aren't separately conserved (or balanced). It seems that during the same period when these developments took place, the notion of "matter" also got more and more conceptually separated from mass-energy, and its separated conservation laws (baryon, lepton) were introduced.
Surprisingly I don't manage to find much historical information on this separation. Can someone point out some early works where matter-conservation laws were introduced?