Create relationship between node and menu link
To create a menu link for a node programmatically and to see it in the node edit form you have to connect the link uri to the node entity:

$item = \Drupal\menu_link_content\Entity\MenuLinkContent::create([
  'link' =&gt; ['uri' =&gt; 'entity:node/' . $node-&gt;id()],
  'title' =&gt; 'Menu item for node ' . $node-&gt;id(),
  'menu_name' =&gt; 'main',
]);
$item-&gt;save();