Let's say you have a custom action path such as:
$wgActionPaths['edit'] = "$wgScriptPath/edit/$1";
Setting $wgMainPageIsDomainRoot = true; will make the edit tab for the main page go nowhere (href="/") rather than the custom action path. This happens for all Main Page actions with a custom action path. The action URLs are getting caught in this if statement in Title.php's getLocalURL():
if ( $wgMainPageIsDomainRoot && $this->isMainPage() && $query === '' ) { return '/'; }
So basically the $query === '' is what prevents this problem in the typical case, but is not sufficient for catching the custom action URLs. At first glance, adding && !isset( $action ) to the if statement check seems to fix it.