Cleanup of rewriters

Ronja expects ORDER BY and WHERE to contain aliases and not the original expressions,
when possible. Our old legacy planner on the other hand, wants ORDER BY and WHERE to
contain the original expressions. To cater for this, this commit moves
reattachAliasedExpressions so it only runs on queries handled by the legacy planner.

reattachedAliasedExpressions was also refactored to follow the code style of other
rewriters.

Author: Pontus Melke <pontus.melke@neotechnology.com>