There's no consensus as to the answer to that question. But even if we accept the genetic accounts offered, the explanation would be that certain Ethiopian and Kenyan tribes living in mountainous areas have adapted to living at high altitudes by adapting to increase the efficiency of their oxygen uptake, which, in turn, makes them better long-distance runners. That has nothing to do with melanin, or even with being Kenyan or Ethiopian, but with a localised adaptation to environment. But again - we can only speculate, no one know's the answer.
In principle genetic populations can adapt to their environment physiologically and cognitively. That follows trivially from natural selection. It is an empirical question if and how that occurs in human groups. I heavily caveated my last reply be because the genetic explanation for Ethiopian and Kenyan running ability is one among many, and entirely unproven. You would have, to validate your thesis, to build up a theoretical case as to why environmental pressures have led to some particular cognitive adaptation, and then to empirically test it. You know as well as I that there is no credible existing such account.