Not every software job is awful though. There's nothing about software itself that make it have to be awful.
Why not just find a different seat and see if that improves your mood? Not every place is organized the same way, not every codebase is spaghetti.