It is the way. The setof/3 goal argument is of the shape TermWithExistentialVars^Goal. This means the qualifier must be part of Goal. TermWithExistentialVars can be anything. The convention is to use Var1^Var2^Var3^Goal.
This extension is used to denote the possibly ^ -annotated goal of setof/3, bagof/3, aggregate/3 and aggregate/4. It is processed similar to‘0’, but leaving the ^ /2 intact.
That’s how the system would know to call M:setof(A, X^Goal, As) as setof(A, X^(M:Goal), As) rather than setof(A, M:(X^Goal), As).