Issue #2421005 by tim.plunkett: Add \Drupal::hasContainer() instead of checking if \Drupal::getContainer() === NULL