Long story short: the culprit was sleep apnea. After a sleep test, I got a CPAP machine. After a bit of time to adjust to the equipment, it made a profound change to my life.
The next year or so was perhaps the most productive of my life. My boss & coworkers remarked it was like I was a different person.
Good quality sleep is important, it turns out!
(Side note: I dropped into REM sleep before my CPAP machine, with lively dreams and stuff. So I didn't really think I had apnea. My faulty mindset of apnea was that you basically couldn't dream at all. But once I had the CPAP machine, my dreams turned into unreal, epic sagas, as my brain started to repair and catch up on all the REM sleep it had missed over the years. My dreams are no longer so crazy, but that first 3-4 months was really interesting)