tree schema BUGFIX resolve parsed exts for main module only

Submodules may reference the main module and need
to wait for it to be fully parsed before resolving.

Fixes #1943
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 9c0d876..49ec92c 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1423,9 +1423,6 @@
     /* resolve imports and includes */
     LY_CHECK_GOTO(ret = lysp_resolve_import_include(pctx, (struct lysp_module *)submod, new_mods), error);
 
-    /* resolve extension instance plugin records */
-    LY_CHECK_GOTO(ret = lysp_resolve_ext_instance_records(pctx), error);
-
     if (format == LYS_IN_YANG) {
         lysp_yang_ctx_free(yangctx);
     } else {
@@ -1604,6 +1601,7 @@
 
     if (LY_ARRAY_COUNT(mod->exts) == 3) {
         /* first extension instances */
+        assert(pctx->main_ctx == pctx);
         LY_CHECK_RET(ly_set_add(&pctx->ext_inst, mod->exts, 1, NULL));
     }
 
@@ -1658,6 +1656,7 @@
 
     if (LY_ARRAY_COUNT(mod->exts) == 1) {
         /* first extension instance */
+        assert(pctx->main_ctx == pctx);
         LY_CHECK_RET(ly_set_add(&pctx->ext_inst, mod->exts, 1, NULL));
     }