Fixing issue with type refresh and structural proxies

Should cache proxies based on the real interface Class, so in case
TypeSystem is refreshed we are not reusing old proxy.

Better solution would be to clean cache when typesystem is refreshed.

(Note: this is a cherry-pick of b3fcf29 from idubrov)