Fix case where `_LazyAutoMapping.register` is passed a `str` key (#47148)