yeah of course there's an optimum amount of exercise before it becomes more harmful than helpful. training for ultra distance races definitely sounds like pushing the limits of human capabilities, which means you're probably trading off other parts of your life to make it happen.
for anyone that doesn't obsess over exercise it's probably almost always a net positive, including for sleep (from personal, anecdotal experience).
Also, I read that when doing more demanding training, in particular very long distances, it's possible to get into a "hypermetabolic" state where one doesn't sleep as well. Anecdotally I've felt this way after doing what for me are longer runs, say > 30 km.
I haven't experienced inability to think hard, even when I was doing more intense running. The more plodding kind I do these days I find is great for brain work as it lets me clear my mind of distractions and think about problems I'm working on. But it sounds like you are training harder than me