Preferably an industry halfway to monopoly. Companies that don't compete every day for survival don't worry as much about raises and have much less politics, because people aren't always on the edge of being fired.
There are a lot of interesting problems in those industries, but they're not flashy, so they rarely attract coattail riders, corporate cutthroats, and empty suit salesmen.
And frankly there are very few compelling and accessible problems in software at all in the private sector for software as such. Interesting problems you can use software to solve, yes. Interesting software problems (that aren't better situated at a research program at a university)? Not a whole lot.
Avoid volatile markets that suffer speculation or primarily employ low wage workers or minimal skills workers, or both. Not because poor or uneducated people are tough to deal with-- ime they are more pleasant than the college educated a lot of the time-- but because it makes it very easy for companies to lay off large sections of their work force. (Think agriculture or construction.)
Speculation causes booms and busts. Low wage work does the same as the market for work expands and contracts. Insecurity makes people cutthroat, and if they can fire their main workforce and rehire identical cogs two years later, then your job supporting those people can come and go, too. High skills labor force makes a company think twice about letting people go, because they might be hard to find again later. (You can fire your Fortran programmer, but good luck finding a replacement quickly and for the same price in two years...)
As you point out, leadership at a company can change all of this. They can foster a better culture. The problem is knowing this in the first place about an employer, attempting to get located inside the company wherever that magic happens, and then the insecurity of not being clear when the magic will end. (Either because you don't know what created the magic to begin with or because it's dependent on person exoduses that can't be predicted.)
* Open ticket
* Write code for ticket
* Submit to QA / release
You basically described how many places outsource development. So you are now competing with $5 an hour body shops overseas.
The reason I and many others hire local people, or at least people who want to contribute is to brainstorm and solve problems together with. Just turning specs into code is not worth paying someone 10x the overseas wage.
Now all your problems I understand. Perhaps try working at a smaller shop somewhere? Maybe a company < 20 total people, especially one that isn't 100% developers. Tons of little companies need a dev or two, but they don't have any of the standup and paperwork type stuff. Just some problems to solve, and a reasonable pace of life. Basically "boring backoff" type jobs.