The vast majority of software projects fail. Honestly, I can't remember ever in my career working on a project I really believed in.
Sometimes I do enjoy the challenge of doing the impossible. Turning a doomed project around or at least minimizing damage. I had some where I thought "this worked out but if anyone but me had been in charge, yeah this would have been a disaster". That feeds my ego. Though I never ever get any thanks from management or any praise. Though this is more of a German culture thing.
There is a reason why burn out is so high in software dev. You are set up to constantly fail. If you succeed against all odds you get more and harder work until you fail.
You got to focus on yourself and find joy in the little challenges. Don't fret over things that you can't change.