I wasn't 20 years into my career when I did this (more like 10), but at one point I had a serious "lapse of faith" with regard to my career. I was working for a terrible company with an even worse manager and I was miserable. I didn't know if I wanted to be a programmer any more. I quit my job and didn't look for another one.
Instead, I wrote free software -- initially just for a month. I got up in the morning, had a shower and worked on whatever project seemed interesting to me at the time (which was actually the GNOME Corba ORB -- that's how long ago this was ;-) ). At first I was pretty unproductive (and I'm not sure I ever actually made a contribution... can't even remember). I watched the stock market go up and down on the TV and occasionally turned the channel for more educational content (I invented the "Teletubbies Drinking Game" -- Drink whenever they say "eh oh" and drink twice whenever they say "again!"... which is to say that I don't think I ever lasted an episode).
Anyway, one day I was having a shower and I had an idea about programming (I can't remember what it was). I ran out of the shower and started typing away. Every day after that I had a similar experience. It took me a week before I realised that I was so preoccupied that I often wasn't wearing any clothes. (Actual awkward conversation: I was chatting with a woman who was moving out of the apartment. She recognised me: "Oh you are that nice man who programs by the window every day. Such a shame I will miss that from now on"...)
After about 6 months of doing this, I realised that I loved programming. I hated my job. The hatred of my job so overwhelmed my natural love of programming that I got to hate it too. But, like a starving man, as soon as I had the time to get back to my passion, I was ravenous. After that, I was much more careful to take jobs that I liked. I often worked for incredibly low salaries just because I liked the people or I liked the project. I was also careful to save enough money so that I could always take a "sabbatical" -- just quit my job and spend half a year writing code that I wanted. I was single (despite/because of my proclivity for exhibitionist programming), so it was easier, but I think it can be made to work in a family setting too.
I think the best thing I can say is that when taking a job, it's important to find a win-win situation. I find that when I get in trouble it's because I end up doing things that I think are important for the company, but which I don't want to do. Often these are things that my management don't want me to do either, which leads to a bad relationship with the management. I usually think, "Oh this is crap! They are totally dropping this stuff on the floor. Someone has to clean up this mess" and then get trapped into doing lots of stuff that saves the company, but destroys my soul (and somehow makes me an enemy of many of the people around me). So instead, I just try to do the things that both my management and I want me to do. Usually there is more than enough stuff that I want to do that we can find a mutually beneficial overlap.
The most important point: I let the company burn down around me as I play my fiddle. Um... Maybe not the most apt analogy. But I hope you get the point. I only do the non-fun parts of my job, if I really get the impression that somebody wants me to do it! That makes such a massive difference, it's incredible (although I often make the same mistakes of the past, but I try to correct it). When the company is intent on flying into a wall at 1000 miles an hour, I don't stop it. I just start looking for another job ;-)
OT, but as someone who worked on it, what in your opinion was the reason for the failure of ORBit and Bonobo? I very frequently find myself wishing we (as an industry) had stuck with CORBA and (D)COM, instead of finding ourselves now writing shitty 'microservices' with JSON serialization or ad hoc crappy binary protocols when we get 'fancy'.
So many things were developed in the late 1990's and early 2000's that indeed were hairy and tricky to use; and as a fresh developer I too hated much of it and tried to avoid them. So in that sense I was part of the problem. But now that I have some years of experience, I can't help but feel that we do so much things in ways that were solved 20 years ago, just because the newcomers in the field don't understand or can't be bothered to learn the history and why things are the way they are - and the whole 'simple framework of the months' cycle keeps going.
I guess this topic is relevant to the discussion after all - I think much (at least some) of our burnout is because of this never ending cycle of 'new' for the sake of new, yet seldom really better than what we had before. But maybe it's just rose colored glasses, and things now really are better...
Instead, I wrote free software -- initially just for a month. I got up in the morning, had a shower and worked on whatever project seemed interesting to me at the time (which was actually the GNOME Corba ORB -- that's how long ago this was ;-) ). At first I was pretty unproductive (and I'm not sure I ever actually made a contribution... can't even remember). I watched the stock market go up and down on the TV and occasionally turned the channel for more educational content (I invented the "Teletubbies Drinking Game" -- Drink whenever they say "eh oh" and drink twice whenever they say "again!"... which is to say that I don't think I ever lasted an episode).
Anyway, one day I was having a shower and I had an idea about programming (I can't remember what it was). I ran out of the shower and started typing away. Every day after that I had a similar experience. It took me a week before I realised that I was so preoccupied that I often wasn't wearing any clothes. (Actual awkward conversation: I was chatting with a woman who was moving out of the apartment. She recognised me: "Oh you are that nice man who programs by the window every day. Such a shame I will miss that from now on"...)
After about 6 months of doing this, I realised that I loved programming. I hated my job. The hatred of my job so overwhelmed my natural love of programming that I got to hate it too. But, like a starving man, as soon as I had the time to get back to my passion, I was ravenous. After that, I was much more careful to take jobs that I liked. I often worked for incredibly low salaries just because I liked the people or I liked the project. I was also careful to save enough money so that I could always take a "sabbatical" -- just quit my job and spend half a year writing code that I wanted. I was single (despite/because of my proclivity for exhibitionist programming), so it was easier, but I think it can be made to work in a family setting too.
I think the best thing I can say is that when taking a job, it's important to find a win-win situation. I find that when I get in trouble it's because I end up doing things that I think are important for the company, but which I don't want to do. Often these are things that my management don't want me to do either, which leads to a bad relationship with the management. I usually think, "Oh this is crap! They are totally dropping this stuff on the floor. Someone has to clean up this mess" and then get trapped into doing lots of stuff that saves the company, but destroys my soul (and somehow makes me an enemy of many of the people around me). So instead, I just try to do the things that both my management and I want me to do. Usually there is more than enough stuff that I want to do that we can find a mutually beneficial overlap.
The most important point: I let the company burn down around me as I play my fiddle. Um... Maybe not the most apt analogy. But I hope you get the point. I only do the non-fun parts of my job, if I really get the impression that somebody wants me to do it! That makes such a massive difference, it's incredible (although I often make the same mistakes of the past, but I try to correct it). When the company is intent on flying into a wall at 1000 miles an hour, I don't stop it. I just start looking for another job ;-)
YMMV.