Remove transitive instances when importing

This was the main cause of the slowdown. The instance graph was around 300K nodes large.