Iterate options per path for baked cache key
Fixed an issue that was both a performance regression in 1.2 as well as an
incorrect result regarding the "baked" lazy loader, involving the
generation of cache keys from the original :class:`.Query` object's loader
options. If the loader options were built up in a "branched" style using
common base elements for multiple options, the same options would be
rendered into the cache key repeatedly, causing both a performance issue as
well as generating the wrong cache key. This is fixed, along with a
performance improvement when such "branched" options are applied via
:meth:`.Query.options` to prevent the same option objects from being
applied repeatedly.
Change-Id: I955fe2f50186abd8e753ad490fd3eb8f017e26f9
Fixes: #4270
(cherry picked from commit
006da86a398f98b899c04bb9e4eee2e9a4cf10d4)