Zend certified PHP/Magento developer

Magento 2: Blocks missing identities

When working with Full Page Cache and Varnish, the blocks are suppose to pass an array on the function afterGetOutput, by using the function $block->getIdentities(). These arrays are then merged into the X-Magento-Tags. We have noticed that a couple of blocks had null value on the $block->getIdentities(), and would create an exception for that page.

As a workaround we implemented the following code on the file /vendor/magento/module-page-cache/Model/Layout/LayoutPlugin.php

if ($block->getIdentities())
{
$tags[] = $block->getIdentities();
}
else
{
$tags[] = array(0=>"Test");
}

We would like to ensure that all blocks have identities, and remove the workaround. How do the block identities get assigned?