The simplest solution is probably to use as condition
\+ predicate_property(Goal, imported_from(_)).
A full meta interpreter that deals with the module system has to keep track of the module context, use the above as well as predicate_property(Goal, meta_predicate(Spec))
to properly resolve the module context for the arguments of meta-predicates. And … deal with cuts, etc.
This is all doable, but pretty complex. Meta interpreters are nice for tutorial purposes. You rarely find them in real life. In cases you would need them the rules are typically represented as facts rather than Prolog clauses.