Fix the interaction of projection and sortSkipAndLimit

Both in the regular and aggregating cases, sortSkipAndLimit should
only happen after projection so that the aliases used in ORDER BY
are already in scope. In addition, this enforces the contract that
by the time sort is performed, all sort items are pure identifiers,
which simplifies a fair bit of logic.