Why is the output from getDefinition($type) different from getStorage($type)->getEntityType()?
After digging into the internals of the entity type / storage management, I am fairly confident that I have found the answer: $this-&gt;entityTypeManager()-&gt;getStorage($type)-&gt;getEntityType() uses the result of EntityManager::getActiveDefinition which loads a sort of cached representation of the entity type. This was introduced by https://www.drupal.org/project/drupal/issues/2554235 which added the concept of last installed definition, which is meant to mitigate problems during update processes.
The difference between codebase and database means that the entity may need an update, like the following:
$codefieldstoragedef = $this-&gt;entityTypeManager-&gt;getDefinition($this-&gt;entityType-&gt;id());
\Drupal::entityDefinitionUpdateManager()-&gt;updateEntityType($codefieldstoragedef);

As $this-&gt;entityTypeManager-&gt;getDefinition() returns the codebase representation, this will tell Drupal to update the database representation with it. After doing this (preferably in a hook update), the entity keys will match.

This answer is also meant to fix some entity definition mismatch as shown in the status report page, especially regarding base fields to update which are used as entity keys.