This issue is also causing a 867 campaign issue where one certain Onneca, who is married to an Umayyad prince, semi-regularly inherits the crown because of Equal Succession and thus turn the Kingdom over to the Andalusians.
This happened to me me like 2 days ago... I was like WTF the AI just decided to 1) Give the Kingdom to his daughter in a non-Matrial marriage (Dynasty lose the crown... WHAT!), Married to a Muslim (Religion lose the crown... WHAT!)... and that BEING part of a Male Preferred religion WITHOUT that heir being better (skills/traits wise) to any of her brothers O_O'
I wrote a post called I just saw the AI do the dumbest move EVER lol