Fixes Issue #13466.

Changed the call to a scope block to be evaluated with instance_eval.
The result is that ScopeRegistry can use the actual class instead of
base_class when caching scopes.