code: public function getMenuFilesData()
      {
          \Yii::beginProfile('admin-menu');
  
          if ($this->_menuFilesData !== null && is_array($this->_menuFilesData)) {
              return (array)$this->_menuFilesData;
          }
  
          $paths[] = \Yii::getAlias('@common/config/admin/menu.php');
          $paths[] = \Yii::getAlias('@app/config/admin/menu.php');
  
          foreach (\Yii::$app->extensions as $code => $data) {
              if ($data['alias']) {
                  foreach ($data['alias'] as $code => $path) {
                      $adminMenuFile = $path.'/config/admin/menu.php';
                      if (file_exists($adminMenuFile)) {
                          $menuGroups = (array)include_once $adminMenuFile;
                          $this->_menuFilesData = ArrayHelper::merge($this->_menuFilesData, $menuGroups);
                      }
                  }
              }
          }
  
          foreach ($paths as $path) {
              if (file_exists($path)) {
                  $menuGroups = (array)include_once $path;
                  $this->_menuFilesData = ArrayHelper::merge($this->_menuFilesData, $menuGroups);
              }
          }
  
          ArrayHelper::multisort($this->_menuFilesData, 'priority');
  
          if (!$this->_menuFilesData) {
              $this->_menuFilesData = false;
          }
  
          \Yii::endProfile('admin-menu');
  
          return (array)$this->_menuFilesData;
      }
docs: Scan admin config files
  @return array