This sounds like burnout to me. I am in my mid-40s and used to have spells like this, but no more. I needed some kind of large change, back then, to get myself sorted out, but this could be pretty destructive because if I waited too long, the change I'd need wouldn't really be conducive to staying on whatever project I was on. The key to not having to deal with this problem anymore, for me, was starting to proactivel…
Getting fed up with all the stupid technology grind is not necessarily burnout though. One could call it wisdom or experience too.
In my 40s, I can hardly stand certain aspects of the tech space... and keeping motivation is all about things I can make, but not make for others.
Find something that sparks your imagination. Skill atrophy is my main thing. Mitigating skill atrophy on legacy skillsets, sub-sets of skills you have used for 20 years, but have no passion for any longer is tough as HELL -- and it makes me feel I can't learn... but the fact is I fail to learn anything I dont have a spark of passion about.
And I am not talking that romantic passion that some billionaire founder is taking about -- I am talking about *enough* passion that your ADHD can be quelled, and that small distractional things dont have undue heavy draw against your attention (passion)