The wrong condition:
The code is wrong because the $this->_scopeConfig->getValue('web/default/cms_home_page', ScopeInterface::SCOPE_STORE)
expression can return not only a page identifier, but a page identifier with suffix too:
So the wrong condition can compare, for example, the home
string with the home|5
string.
My fix
Replace the wrong code with the new one:
&& $page->getIdentifier() !== explode('|', $this->_scopeConfig->getValue(
'web/default/cms_home_page',
ScopeInterface::SCOPE_STORE
))[0]