[jit] Fix ModuleDict type sharing (#33515)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33515
Previously, if we had a `ModuleDict` with the same value types but
different names for keys, they would share types under certain
conditions. This only happens for `ModuleDict`, because in other cases
a simple Python class check invalidates the class.
Test Plan: Imported from OSS
Differential Revision: D19978552
Pulled By: suo
fbshipit-source-id: f31b2af490064f89b70aa35f83ba740ddaf2a77a