Backport #14154 to 4-1-stable

This allows the default scope to be built using the current table alias.
Resolves #12770

/cc @tenderlove