Well, making everything rawable is always a good move in my opinion, but something like this would be quite difficult from a programming standpoint, as it would mean a major overhaul of creature behavior, entity ethics, possibly even noble positions. So let's take it from the top.
I propose relationships as being connected to entities. They represent social contracts - not entirely unlike nobles, but tied to regular members of the civilization.
Step one: remove all sapient-specific automatic behaviors. No more hard-coded marriage, lovers, grudges, etc. Under the new system, creatures belonging to an entity without associated relationships will initially behave exactly like wild animals of their species. They will mate with whoever they want when they feel like it, assault whoever they feel like, steal whenever they want something, and so on (modified by their personality values, like GREED, LUST_PROPENSITY, COMPASSION, and so on). This essentially represents the species' "id", and determines what the creature "wants".
These behaviors will be regulated by the associated ETHIC tags (i.e. the society's expectations of them, or "superego"), of which I propose adding one more:
[ETHIC:MATE:PUNISH_SERIOUS]
Or whatever, depending on how opposed the civ is to promiscuity. Now obviously, this will result in a civ dying out pretty fast normally, BUT it only applies to behavior in absence of a relationship tag, in this case:
[RELATIONSHIP:SPOUSE]
[NAME:spouse]
[MUTUAL]
[MAX_NUMBER:1]
[REQUIRES:LOVER]
[ETHIC_OVERRIDE:MATE:ACCEPTABLE]
[SAME_RACE_ONLY]
So basically, the relationships override the 'default' ethics to make certain behaviors acceptable where otherwise they would not be. Of course, this allows more interesting relationships, such as:
[RELATIONSHIP:GRUDGE]
[NAME:rival]
[MUTUAL]
[ETHIC_OVERRIDE:ASSAULT:PERSONAL_MATTER]
Which would be good for a 'blood knight' society and would allow there to be mutual rivalries that would operate outside the law. Attacking some random passerby would be a crime, but if they're your rival it's okay.
Or even weird alien things like
[RELATIONSHIP:HATELOVER]
[NAME:hatelover]
[MUTUAL]
[MAX_NUMBER:1]
[REQUIRES:GRUDGE]
[ETHIC_OVERRIDE:ASSAULT:ACCEPTABLE]
[ETHIC_OVERRIDE:MATE:ACCEPTABLE]
Ethic overrides would be the main determining factor in how likely it is for a relationship to start. If person A is attracted to person B, and they both want to mate but their society forbids promiscuous mating, they may marry and make it acceptable. If person A hates person B and they want to have fights without the law getting on their case, they can become rivals. It could get even more interesting if the ETHIC_OVERRIDE made one activity more acceptable and another activity less acceptable (for instance, if murdering your spouse is worse than murdering a random stranger).
For multi-step relationships, the AI would have to 'look ahead' in order to plan out its relationship advancement (for instance, becoming LOVERs in order to become a SPOUSE later) and weigh out the costs and benefits of entering a relationship.
Now for less mutual relationships:
[RELATIONSHIP:PROTECTOR]
[NAME:protector]
[ALLOWED_CREATURE:BUG_MAN:SOLDIER]
[OTHER:SUPPORTER]
[MAX_NUMBER:1] (meaning each supporter could only have one protector)
[RESPONSIBILITY:PROTECT]
[ETHIC_OVERRIDE:ASSAULT:ACCEPTABLE]
[RELATIONSHIP:SUPPORTER]
[NAME:supporter]
[ALLOWED_CREATURE:BUG_MAN:WORKER]
[OTHER:PROTECTOR]
[MAX_NUMBER:10] (meaning one protector could have up to 10 supporters)
[RESPONSIBILITY:PROVIDE_FOOD]
This would allow you to make a race of bug people where large soldiers are responsible for protecting a group of smaller workers from harm, watching over them and attacking nearby enemies (although is also allowed to abuse them), and in exchange the workers feed their soldier. Almost like 'pseudo-nobles'. This could also apply to societies where a male husband is responsible for providing for his wife, or concubine systems, etc. (I used ALLOWED_CREATURE rather than ALLOWED_GENDER in this case, although presumably either could be used. ALLOWED_CLASS would be an option as well, for multi-racial civs that use CREATURE_CLASS.)
Responsibilities could include [PROVIDE_FOOD], [PROVIDE_CLOTHING], [PROTECT], [EMOTIONAL_SUPPORT] (functionally similar to MEET_WITH_WORKERS for nobles).
If a society did not have a mutual SPOUSE, but did have separate HUSBAND and WIFE relationships that only allowed their associated genders, homosexuality would be forbidden by that society, although it might still happen if the creatures wanted it enough.
Nobles could also be tied to relationships. For instance, some nobles might FORBID certain relationships (like a priest that is forbidden to marry) or REQUIRES certain relationships (like a priest that is REQUIRED to be married), or a relationship could be EXPECTED, where the noble can be appointed without the relationship, but is then under pressure to form a relationship.
Relationships should probably also include causes for breaking off (most likely, based on breaching exclusive rights, which could be obvious things like mating but also more alien things like recieving food or even emotional support from someone else), and consequences for breaking them. The cause and consequences would all be weighed against each other in order to determine how likely it would be for a unit to make any decision.