Programming cooperation

Usually, this would be written
setof(C, A^B^(my_module:my_goal(A,B,C)), Set).

It’s easy to get the “exists” items wrong (and even easier if there are anonymous variables, or “joining” variables), so I would suggest:

my_goal(C) :- my_module:my_goal(_A,_B,C)
... setof(C, my_goal(C), Set)

(also, if you import my_goal, then you don’t need my_module:...)

As to differences between findall/3 and bagof/3 (besides the existential variables), here are examples where findall/3 breaks “pure logic” (e.g., you can define not/1 or var/1 using findall/3):

This doesn’t mean that findall/3 shouldn’t be used, but you need to be aware of the same kinds of things that cause problems with “not” or negation-as failure. I prefer to use this instead of findall:
( findall(C, my_goal(C), set) -> true ; C = [] )