My fix
The code to be corrected is:
Replace it with the code:
/** @var \Magento\Framework\ObjectManagerInterface $om */
$om = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Framework\App\State $state */
$state = $om->get('Magento\Framework\App\State');
/** @var bool $isAdmin */
$isAdmin = 'adminhtml' === $state->getAreaCode();
$preparedTitle = ($isAdmin ? '' : $this->scopeConfig->getValue(
'design/head/title_prefix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)) . ' ' . $title . ' ' . $this->scopeConfig->getValue(
'design/head/title_suffix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
Admin area detection code is from here: Check programmatically whether we are in admin panel