Move references from module scope to instance scope if we determined that these references are store subscriptions fixes #9580