Fix from builder optimisation when building queries

Construct the query at compile time but move the only dynamic part of query (the model’s source) to runtime. This removes unnecessary compile time dependencies between modules but still keeps the optimisation.