Description
One example on how to reproduce:
1. Create a group test3 and add a member X.
2. Create a group test1 and add test3 as a member.
3. Create a group test2 and add test1 as a member.
The parent membership of the membership with owner_id=test2, member_id=X, and list_type=list is incorrect. One affect of this is that if you now delete the group test2, this membership does not get deleted.