Accommodate for base class when adjusting path for with_polymorphic
Fixed an additional regression in the same area as that of :ticket:`5080`
introduced in 1.3.0b3 via :ticket:`4468` where the ability to create a
joined option across a :func:`.with_polymorphic` into a relationship
against the base class of that with_polymorphic, and then further into
regular mapped relationships would fail as the base class component would
not add itself to the load path in a way that could be located by the
loader strategy. The changes applied in :ticket:`5080` have been further
refined to also accommodate this scenario.
Fixes: #5121
Change-Id: I9753dbbcb7b7640c995ad983a6d04b36fa18cf54
(cherry picked from commit
c9406e58a4fd2de4bb2fd53530e04cc9fc786cbf)