I was running into the same issue. Even after clearing cache it did not remove the 'Show pagesource' link, so I did some digging.
In my case I have in tpl_header.php:
tpl_action('edit', 1, 'li');
Following that through to inc/Action/Edit.php I found this:
/**
* @inheritdoc falls back to 'source' if page not writable
*/
public function checkPreconditions() {
parent::checkPreconditions();
global $INFO;
// no edit permission? view source
if($INFO['exists'] && !$INFO['writable']) {
throw new ActionAbort('source');
}
}
So basically if the page is not editable by the user it falls back to providing the 'Show pagesource' link. What I did was wrap the tpl_action in tpl_header.php like this:
if ($INFO['isadmin']) {
tpl_action('edit', 1, 'li');
}
Now the 'Show pagesource' link is gone, even for superadmin because it has edit access.