Fixed #23877 -- aggregation's subquery missed target col

Aggregation over subquery produced syntactically incorrect queries in
some cases as Django didn't ensure that source expressions of the
aggregation were present in the subquery.
Oh, of course, sorry. Totally missed the loop somehow. Ignore this, I think it's fine as-is.