The problem is if it puts one UB with another building then the other one can’t be used to make that high yield UQI've heard it said that the AI just goes by what would give the highest yields and does not take into account the Unique Quarter benefits. Though it's also said that this might often be the right approach instead of blindly building Unique Quarters in every city (depending on the civ, of course).