Fix missing parent in inverse associations building

Fixes #9157.