You can try using Magento Plugin for enhancing existing functionality of any Abstract class, although the scope of the function should be Public.
Recently I worked on same issue where I need to exclude products having a custom attribute assigned from the Recently viewed product list.
I used plugin for the function named getItemsCollection from the class named Magento\Reports\Block\Product\AbstractProduct using the following syntax:
file: app\code\Package\Module\etc\frontend\di.xml
<type name="Magento\Reports\Block\Product\AbstractProduct">
<plugin name="Package_Module::aroundGetItemsCollection" type="Package\Module\Block\Viewed" sortOrder="20"/>
</type>
file: app\code\Package\Module\Block\Viewed.php
public function afterGetItemsCollection(
$subject, $result
) {
$result = $result->addAttributeToFilter('skip_hire_product', [['neq' => 1], ['null' => true]], 'left');
return $result;
}
You can use around as well as before plugins too.
Hope this work for you.