Because hope is a story you tell yourself, you can blunt or escape burnout by reframing your situation into one that is entirely about internal rewards instead of external rewards which you cannot control.
For example, in a failing situation you are gaining experience and the chance to develop skills you can use later.
The difficult cases are when you have external dependencies that can’t be met like supporting a family.
When I was younger I always felt I could quit so I worked without fear and did amazing work. But when I felt I couldn’t quit, it was painful.
My entire life I have watched tech burn people out and I then got my turn after I had kids. The lesson is to remember that industry moves with the money printing. The high salaries are double reality and to keep expenses low so you can survive the financial cycle.