Prevent uninitialized constant errors

Do not attempt to constantize the table a relation refers to if that
relation node is actually an alias for a table. ActiveRecord will alias
tables within eager load queries and these table aliases don't actually
exist, so attempting to constantize them will result in a NameError.