Ok, not sure if I understand correctly what you want to achieve. Also I never played Crusader Kings so I am sorry if I misunderstand some aspects.
If you want to prevent sexual content with underage NPCs the obvious solution is to store their age and any sexual interaction with said npcs to be blocked, and maybe provide a way for players to skip years ahead without ruining the gameplay, or as you said some kind of method to accelerate growth: gods or magic or whatever.
The problem of preventing incest on the other hand is very interesting and made me think for a bit. So here is a quick untested thought on how I would approach the problem:
For each NPC I would store the following:
1. A generation number - a simple number that might be useful for some stuff, each NPC would have their generation = max(mom generation, dad generation) + 1
2. A gender - male or female - 0 or 1 or however
3. A "genetic encoding" of sorts, a simple representation of who the parents are.
For example let's use a 2 character hexadecimal representation for the first generation of NPCs this allows you to have 255 females and 255 males, a total maximum of 510 NPCs in your first generation since you can reuse them.
Each child would have their genetic encoding as a concatenation of the parents encoding or some other way of storing the parents encoding.
The child of 1A and 2C will have the encoding 1A2C for example, also note that padding with 0s might be needed in some relations to help with even splitting: The child of 1A and 2B3D could be 001A2B3D
4. An additional separate number to differentiate multiple children of the same parents while still keeping the same encoding: 1A2C (1) and 1A2C (2) for example
When you compare 2 NPCs you compare their encodings and you have the following situations:
- Same encoding and same child number = same person - should be impossible but I added it anyway.
- Same encoding, different child number = brother or sister
- one npc full encoding matches half of the other npc = mother / father or uncle / aunt, you could differentiate exactly if needed by using the child number from parents in the encoding somehow
- one npc full encoding matches a quarter of the other = grandparents
- half of npc encoding matches half of other npc = cousins.
And so on by this point I hope you get the ideea.
The immediate drawback to this is as generations grow the encoding would get way too large and at some point you would have to cleverly reset them and recompute them for all the living npcs.
This is just a quick ideea I came up with while thinking on the problem, obviously with more time and tought put into it better ideas could come but I hope at least I gave you a good starting point.
Apologies if this is not what you wanted
