Yes, it has happened to me, more than once. You start from scratch, learn on the job, and produce something you are proud of, you iron out the problems and make improvements. Then the whole thing is chucked in the bin without even a thankyou for handing it on in good shape and a mention of how your successor hopes their version will compare well with yours.
There is another side to it, of course. Taking over something that someone else has done well is like stepping from understudy to prima ballerina, with no rehearsals and wearing a costume that doesn't fit. The army has a solution - when you get a promotion, you are posted to a different unit, so you can't see what a hash your successor is making of things, and you don't have your predecessor breathing down your neck as you try to hit the ground running.