I’ve seen this state of mind many times in people around me and I have to say most of the times it’s not the job, but more likely the day to day life outside of it, and people around you.
But but..The predictability of everyday life and the misalignment with one’s desire for discovery and adventure which I would guess is what drove a lot of us into aviation, can really demotivate. Some people never had it in them, and are fine with staying put, in fact it’s all the wish for. Most people are resigned (or made so!), some others can’t really take it. Each person needs to have a hard look in the mirror and understand where he belongs.
Flying short haul for a big airline in Europe can definitely feel like going to a factory, or groundhog day.
I would definitely advise against leaving aviation in your 40s, whatever other career you find I would be very surprised if it gave the same financial and mental freedom you enjoy now.
For what it’s worth, a few years ago when I started feeling I was not enjoying anymore I packed up and went flying to the other side of the world (with family). And I love it, everything got interesting again and I feel I am learning every day in and outside of work.
Life is short, there’s no excuse, only fears. Good luck.