core: Fix name-to-id cache invalidation

(cherry picked from commit 13e348ecba1c84435344e067ceb12d7d4b6c7801)