Decoder are not supposed to lose any program setting changes you make to them over the life of the locomotive. Like wise it should never lose it settings when power is lost. You should be able to set the decoder and forget as in use it the way you inteded for it to work for the reset of its life. ASSUMING there is nothing wrong with the decoder, anytime a decoder losses it programming that DOES NOT involve you giving the decoder a reset command means there is a problem between the decoder and the DCC system. Given there never been a single example of ANY command station issuing a reset command all by itself and the decoder has a long track record of working fine on other layouts, the evidence will point in the direction of what is UNIQUE about your layout. That is the layout wiring. No two layouts are wired the same way. Unique as a fingerprint.
As it turns out, a decoder losing its programming is just a LESS extreme case of the same issue that causes permanent damage and requiring return of the decoder for repair.
To learn more about both root problem and the solution, go here:
Decoders blowing up?