Both \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::RECURSIVE_RENDER_LIMIT and \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::$recursiveRenderDepth are deprecated.
A referenced entity can now be successfully re-rendered more than 20 times. Example use cases:
- Running batch search indexing on rendered content with the same media referenced by multiple indexed nodes.
- Rendering a node multiple times in a batch to be sent out as email newsletters.
Rendering recursion is now protected by tracking whether an entity is currently being rendered. This is done in Drupal\Core\Entity\EntityViewBuilder, where #pre_render and #post_render callbacks are added to the entity render array in getBuildDefaults(). These callbacks set and unset a tracking array entry indexed by the imploded cache keys of the render array for the entity.