Honestly, I am very over this (I am 42y/o).

I get a stable salary just for doing my stuff with (mostly) independence. If they want to never use it then that's on them and it's their loss. I still learned good lessons by working on it and that knowledge I'll have until my grave.

To me it's a win all-around. I can and will mention it during meetings if the right moment rolls around but won't insist or push hard on using the about-to-be-abandoned code. As a good colleague I'll point out an inefficiency that slows down product launch. If that gets ignored then I shrug it off -- the leader was given the info and chose their present course despite of it. It's their prerogative.