Sounds great. I asked if there was a way to discourage matrilineal marriages yesterday, and someone responded that an event could fire that would override the matrilineal marriage and would label the children as belonging to the father's dynasty. I don't know anything about modding, but is that a reasonable way to fix it?
An event that triggers off birth, similar to say, how some people have modded childbirth death, but which changes their dynasty to their father's, would probably do the trick. But there is still a great deal of AI crap and poor decision-making that is hardcoded into matri marriage, with some noblewomen even marrying worthless lowborn men simply to preserve their entirely OOC game victory score. IRL of course, nobody ever married a commoner to keep their dynasty from being diluted...quite the opposite.
CK2's marriage AI is so awful, that it can't even arrange betrothals for the purposes of alliance, against a threatening power. As far as I know, the sole reason for the AI not using betrothals, is so the player is never blocked from marrying who they want. That's something else I'm trying to figure out how to fix, since a lot of AI behavior can be simulated with hidden decisions that are invisible to the player. You just have to find inventive ways to point them at certain things, that hardcoded values can do more easily...like the respective available manpower of two different realms. The only way I've found to simulate that, is to use realm_size instead, but that's...unfortunate on several levels, since some states, (especially in my mod) can be much smaller, but have vastly more potent armies.
In fact, one of the few ways to tweak marriage more logically, is to go into defines, and jack up the importance of prestige.
But then you get muslims not taking multiple wives...which is lolworthy (But will be patched), and so I had to write an event to make sure muslims took multiple wives in the meanwhile.
A good window, actually, into how screwed up AI marriage is in the base game, is that Christians have the exact same AI-marriage-prestige formula as muslims, who receive no prestige benefits or penalties at all! Unbelievable!
I'll probably issue a walkthrough, that I hope, will help other people fix marriage in their games, when I release this mod officially. A few easy steps and key things pointed out, which when tweaked, should still be compatible with every other mod in existence.