Somalia's problem is that the environment meant that internal trade wasn't enough to be self sustaining and our agricultural output was extremely susceptible to climatic shifts. This leads us to a situation where a sedentary urban civilization in somalia can't maintain continuity and instead collapses. It's why even though we haven't had any foreign invasions and don't speak multiple languages . We don't have a long continous urbanized culture.I used to think that way too. But the more I've read about medieval and early modern history. I've come to realize this would have been impossible. The distances between somalis are incredibly huge and you would have needed a large sedentary pouplation to wage war and centralized power. That needs a huge agriculture base to accomplish.
Also, the Ottoman empire and the safavids spent a huge amount of effort fighting nomadic pastoralists. Which shows you how difficult it is to control pastoralists, and I don't think in the premodern world it would have been possible to bring a territory that large under control. Even southern somalia with the climatic changes of the 1600s and 1700s combined with the oromo invasions and decline of trade networks compelelty collapsed.