Yes we know that Mogadishu was controlled by them until 2011 but that was back when Al-Shabab was an actual formidable force. They were having major losses from 2012-2013 which forced them to transition into a guerilla movement that could now only take villages and bases.They were inside mogadishu before foreign powers helped push them out, and just look at all the land they own, i can guarantee you if they manage to besiege xamar again you will see all the politicians on the first flight
To prove my point, here is an analysis from westpoint from last year that assesses the capabilities of the SNA and Al-Shabab. It pretty much states what we already know: that Al-Shabab is militarily stronger and more cohesive than SNA. However, they make it very clear that Somalia is unlikely to face an Afghanistan situation.

The Somali National Army Versus al-Shabaab: A Net Assessment - Combating Terrorism Center at West Point
Abstact: An important question for the future of Somalia is if the African Union withdraws the remainder of its forces from the country by December 31, 2024, would the Somali National Army (SNA) or al-Shabaab be stronger militarily? According to a net assessment conducted by the author across...

In Somalia, the ATMIS exit raises legitimate security concerns, but a similarly rapid and complete collapse of the SNA and total victory for al-Shabaab is unlikely. Not only would the SNA retain significant external security assistance from the United States, Turkey, the European Union, UAE, Qatar, the United Kingdom, and other countries, but ATMIS’ departure would undermine a key element of al-Shabaab propaganda. Moreover, the SNA already endured the partial withdrawal of a key security partner when the Trump administration removed most of the roughly 700 U.S. troops from Somalia in December 2020. The impact on the SNA was not positive but nor was it catastrophic: The United States retained its logistical, training, and mentorship support packages, and many of the withdrawn troops continued “commuting to work” from the wider region and Europe. In May 2022, the Biden administration redeployed some 450 U.S. soldiers to Somalia. The issue at hand is whether the departure of ATMIS could be more consequential.