Pre-populate an entity reference field (media image) when creating a node
It's much easier to prepopulate field values on entity level rather than on form level:

/**
 * Implements hook_ENTITY_TYPE_create() for 'node'.
 */
function mymodule_node_create(\Drupal\node\NodeInterface $node) {

  if ($node-&gt;getType() == 'my_content_type') {
    $media = \Drupal::entityTypeManager()-&gt;getStorage('media')-&gt;load(38);
    $node-&gt;field_image[] = $media;
  }

}