Pass a base relation to build_default_scope when joining

This allows the default scope to be built using the current table alias.
Resolves #12770
Merge pull request #14508 from al2o3cr/pull14154-4-1-stable

Backport #14154 to 4-1-stable