Scanning the code suggests that this is supposed to be intentionally deactivated for married sims...except if both sims involved in the process are Romance sims.
The actual code for this is buried in a deeply-rooted and somewhat heavily used global function where it assumes that if there is a certain level of chemistry between two sims that they have a crush and/or are in love, even if they don't have this as a relational state. Other forms of aberrant amorous behavior may be similarly caused by this.
Shooting this piece of code down may produce an interesting ripple effect on the rest of the game, possibly mowing down large chunks of the chemistry system. Shall I go for it anyway?
If the assumption in the bottom of the global function is incorrect, and you correct it, is it possible the ripple effect would actually sort out some of the logical inconsistancies to do with attraction or do you think the code is too messy overall?
Yes, go for it, that's my vote.