I think it is more simple than you realize. I noticed some time ago (looking at your code) that you made the number of workable city plots include the 3rd ring by default and then in some of the checks you switch it back to only include 2 rings.
It should be the other way around to avoid the current problems - keep 2 rings the default and only increase to include 3rd ring when Kurioate is involved.
I am assuming you made this change to make it easier for the AI to handle the Kurioate work properly (without too much extra coding required), but the side effects is causing serious problems for AI when trying to handle all of the other civs.
Wouldn't you agree that it would require less work to switch back to the original working plot/ring number and then including custom functions to handle 1 civ - rather than keeping the current way and having to add work arounds for all the rest of the civs?