One possible representation of a family unit that could work quite well is one that is location and time based. That is, everyone who is living in the same residence at the same time is considered a family.
I'll try to illustrate this with this series of examples: A man and woman move in together (whether they get married or not). They are now a family. They have a child who lives with them and is now part of the family. Their parents get sick and move in with them, so they become part of the family. A neighbor's child becomes an orphan, and moves in with them, and becomes part of the family. Their child grows up and moves out on their own and leaves the family. A parent goes to a nursing home and leaves the family. The entire family moves to another home but stays as a family.
What is critical here are that events happen at certain dates, where people enter and leave the family. Families can merge. Families can split into two.
For your "convoluted" example: Father deserts household (leaves family), youngest children put in industrial school (leave family), wife has relationship with new man (he only becomes part of her family if and when he moves in with her), new man has existing children (only family if they moved in) but new ones born to pair of them (most likely with mother and part of family), deserted wife dies (she leaves family), partner starts relationship with new woman (does she move in? Is everyone else still with partner? whoever is, is part of his family)
The one really nice thing about this system is that you can precisely and unambiguously define who is in a family and who is not. There is no relationship required. If unrelated friends move in for a month because their home burnt down, then for that month, the families become one.
My reasoning why this method may be best is what I encountered with father's family. He grew up with his mother, sister and step-father. They were his family. His two brothers grew up in an orphanage. They were indeed full brothers from his real father and mother, but they were not the family he grew up with.
My wife's family is another example. She grew up with her grandparents living with her. They were always treated as part of her family while they lived together, and any definition of family is wrong if they are not included.
The one disadvantage of this definition is that a family will be quite dynamic, with frequent events that causing people to join and leave it. As a result, some family groups will only last days, and one person will be in many different families during their life. This may be difficult for a program to properly present and make useful, but it sure would be a heck of a thing if some smart programmer figured out a way to do it.