[4.2] 'has' clause on 'hasMany' relationships with self relation

"*Eloquent does not alias tables in a self join relationship*" is the title of this Liferaft issue: https://github.com/laravel/laravel/pull/3127 (brought randomly by a `liferaft grab`).

This PR seems to solve the OP issue, which uses a "hasMany" relationship.

Implementation based on https://github.com/laravel/framework/commit/16f099e0bc17d89f1e11aff6343b2999230560a3
this is not guaranteed to be unique.