This can be simplified to:
/**
* Before generate Xml
*
* @param \Magento\Framework\View\LayoutInterface $subject
* @return void
*/
public function beforeGenerateXml(\Magento\Framework\View\LayoutInterface $subject)
{
if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
$this->customerGroupId = $this->customerSession->getCustomerGroupId();
$this->formKey = $this->session->getData(\Magento\Framework\Data\Form\FormKey::FORM_KEY);
}
}
A trick: a «before» plugin can return nothing if it needs not modify any argument