I don't care about what decisions are being made in those places, so I shouldn't get too worked up about decisions being made where I work either.
If, after giving my recommendations, and making my arguments, people still decide to do risky dumb things with infrastructure, I don't let it bother me anymore.
Anyway, being a professional, I put in my hours and did my best to contribute until the contract ran out. But I also stuck a post-it note to the bottom of my screen with my all-time favourite Polish phrase: "Nie mój cyrk, nie moje małpy". Literally: "Not my circus, not my monkeys.". I.e. the inherent brokenness wasn't my problem to fix.
Yes - some parts of any job suck. Some parts have to be dealt with and one needs to have at least some kind of tolerance for frustration.
But there is a threshold. If the job, the people, the culture around you do not show that they respect and value you, but only the bottom line they can grind you down for: Get out.
Yeah, I meant "your job" in the generic way, including everything there is about it. Where you work, who you work with, what you do, for whom etc.
Every aspect of professional life includes things that we'd rather not deal with. Programming? You're gonna have to write boring boilerplate code sometimes. Poor tooling? You're going to have to convince management to give you the budget you need to fix it, and that's going to involve a lot of politics. Meetings? Some of them are going to be a waste of time but you'll have to attend them. Volunteering projects? Some are genuine, some are there only because someone has some KPIs to meet.
These are things that you're going to have to deal with anywhere you go.
Things that you don't have to deal with anywhere you go, however, include stuff like abusive behaviour, regular and unpaid overtime with an expectation that "everyone loves what they do and works 60-hour weeks here", or poor working conditions that take a toll on your health. That's stuff that no one should "deal" with (except, you know, by leaving).
On a slight tangent, I've always found that hobbies - and treating programming as one of them - always helps me disassociate from thinking about my own achievements as only being work-related. I've tried so many things, just because they interested me, and got fairly good at some of them. Sometimes it might be a craft, another time it might be learning a new programming language, or a piece of software I don't know well enough.
The ones I don't enjoy so much fall by the wayside (life drawing, golang, philosophy, whittling, many more), but some chance subjects have directly led to better jobs (ruby, elixir), some have made me a better programmer, and anything else I can at least say has made me a more rounded and knowledgable person, and hopefully more employable because of it.
Figure out what is your vision on the purpose of your job and how it integrates with the perspective of your own professional goals. Then push it as much as you can, thereby building up experience on the path to these goals. If you find an dead end, seek antoher job.
Many times have I confronted my own vision against that of (or lack therof) my hierarchy, and the undertaking of proving my point earned me a great deal of experience, regardless of the outcome (which, over time, has been largely positive, i.e. my vision proven right).
I love my profession -- I wanted to be an engineer for as long as I can remember. But that doesn't mean I loved every engineering job I've ever held. If a job makes you dislike what you do to the point where you stop cultivating your abilities, I think you should leave it as soon as you can.