Add some tests for the issue.
Simplify earlier fix: move inside Select conditions to outer join always.
Move join conditions above a tree of inner joins that only reference tables there out as separate edges, like top-level WHERE conditions.
Adjust expected results.