Fix: Correctly isolate aggregates from expressions that introduce interi...

...or scopes (reduce, fitler, extract, comprehensions)

signed-off-by: Jakub Wieczorek <jakub.wieczorek@neotechnology.com>