Fixed #21662 -- Kept parent reference in prepared geometry

Thanks Robert Scott for the report.