Back to the main topic, if a change is to be made, the AI needs to know how to take into account the production loss from anarchy and the 5 turns wait time to switch again.
The human can exploit this by gettiing the AI to do an insignificant civics change (Serfdom?) to slow down AI wonder completion, delay tech research, delay civics tech implementation (e.g. AI is 1 turn from getting Emancipation, but now has to wait 5 turns after researching it).
This may take a lot of coding, quite complicated to implement.
You seem to be missing the point somewhat. The AI currently considers requests to change civics if they aren't in their favourite civic yet, so some form of evaluation has already been coded in. Making the change suggested doesn't open any new form of exploit for human players.
For those people who've said it should be kept to reflect real life:
It's true that some people cling stubbornly to things in the face of all rationality, and perhaps that should be reflected in civ. However, surely it would be better to actively model this for deliberate inclusion than for it to happen because of a presumably unintentional bug? It's just sloppy coding.