Variables are missing on page--node--add.html.twig
if ($node = \Drupal::routeMatch()-&gt;getParameter('node')) { 


There's no node ID in the route at /node/add/foo, so there's no node available, and that condition will always be false.

You need to create the node yourself, e.g.

// Get the desired type from the route.
if ($node_type = \Drupal::routeMatch()-&gt;getParameter('node_type')) {
  $node = \Drupal::entityTypeManager()
    -&gt;getStorage('node')
    -&gt;create([
      'type' =&gt; $node_type-&gt;id(),
    ]);

  $form = \Drupal::entityTypeManager()
    -&gt;getFormObject('node', 'default')
    -&gt;setEntity($node);

  $variables['node_form'] = \Drupal::formBuilder()-&gt;getForm($form);
}