[runtime] Fix yet another metadata problem with dynamically created types. Fixes #14977.