Executing a method of a custom entity after all instances have been built
You can use an event for this, a RESPONSE event with a low priority or a TERMINATE event. See for example UserRequestSubscriber::onKernelTerminate:

/**
   * Updates the current user's last access time.
   *
   * @param \Symfony\Component\HttpKernel\Event\PostResponseEvent $event
   *   The event to process.
   */
  public function onKernelTerminate(PostResponseEvent $event) {
    if ($this-&gt;account-&gt;isAuthenticated() &amp;&amp; REQUEST_TIME - $this-&gt;account-&gt;getLastAccessedTime() &gt; Settings::get('session_write_interval', 180)) {
      // Do that no more than once per 180 seconds.
      /** @var \Drupal\user\UserStorageInterface $storage */
      $storage = $this-&gt;entityManager-&gt;getStorage('user');
      $storage-&gt;updateLastAccessTimestamp($this-&gt;account, REQUEST_TIME);
    }
  }