https://github.com/wmde/WikibaseDataModel/pull/670 proposes an Int32EntityId interface as a clean way to deconstruct an EntityId into a number. However, this interface is optional and not blocking us since we can do the same via method_exists( …, 'getNumericId' ).
What's blocking us now (see https://gerrit.wikimedia.org/r/#/c/290461/1/lib/includes/Store/Sql/SqlEntityInfoBuilder.php) is the fact that we do not have a service to reconstruct an EntityId from an entity type (or a prefix) and a number. Currently we do this with LegacyIdInterpreter::newIdFromTypeAndNumber (used 8 times in production), but this static method can't learn new entity types.
Patches for review: