Call to deprecated method renderPlain() of class Drupal\Core\Render\Renderer in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Core\Render\RendererInterface::renderInIsolation() instead.
use Drupal\Component\Utility\DeprecationHelper;
$label = DeprecationHelper::backwardsCompatibleCall(
\Drupal::VERSION,
'10.3.0',
fn () => $this->renderer->renderInIsolation($build),
fn () => $this->renderer->renderPlain($build),
);