Change code generated for `bagof/3` and `setof/3` calls with goals only known at runtime for better integration with back-end Prolog tools