Hi Daniel 83 and welcome back to the forum!
Firstly, you are to be congratulated for recognising your issues three years ago and addressing them head on. it seems that you have successfully overcome every single one of them which is amazing, but the mid life doldrums may be reappearing. So you have proven that you are an achiever and accomplish goals that are important to you. That is a significant personal trait.
Add another 30 years to your age to get where I am - I want to share how I felt at your age. I was running my own company, had two great daughters already showing signs of life success, yet I too was feeling a little bit empty. Maybe success and income was coming a little easy to me.
So I thought was I really ready to retire? The answer was a big NO - so I then asked do I maybe want a midlife career change? The answer to this was YES, late 30's is a every attractive age to employers. More importantly, it is also a great time to exercise your creativity and ability, by taking on something outside your work. Anyway the new job gave me plenty of challenges which was great. I bought a sports car kitset and built that up over a year, working on it most nights late, but loving it. That led to a car club and racing. I started learning guitar - that is still going strong, then progressed through the sport of stand up paddleboarding racing. I now have a 14ft race board and train on that 4 times a week. So yes, add other stuff to that and I am now retired but more active than ever and I can look back life on with no regrets at all.
With having kids, 40 is nowhere too late. They will be leaving home by the time you are 60 or so and ready to actively enjoy retirement! What does your partner think about this subject?
So I am thinking your mind might be reset if you actually take on the challenge of a new job, but more importantly, take on some challenges outside work that you actually love doing, and can measure progress against. I know only a couple of people who tried retiring in their 40's but missed the mental stimulation and went back to work.
Joining clubs aligned to your new activities is also great for social interaction and encouraging you to become better at that activity.
I have read that to be happy past middle age, we need goals, mental challenges, physical activities, social interaction and new learnings to take on. That pretty much sums is up.
Sorry to rave on a bit, but I hope some of this has helped. Let me know!
All the best, The Bro