Add `reverse_nested` aggregation

PR for #5485

There a number of todos that need to be addressed.