The theory that changing tiles doesn't alter the RNG itself, but working a mine does because of the resource-pop roll, makes sense from what most people here know of the code, and has been shown twice now. I think it's reasonable to take that as an assumed fact.
In light of that, consider this: instead of writing a piece of code to check for invested hammers in the build queue of every city every turn, it's easier to write a code that weighs the AI's interest in producing a wonder based on the likelihood that the wonder may be in the process of being built somewhere else.
We know (I think? at least it's accepted as fact, for sure) that the AI is deterred from researching the "goodie" techs when the first person reaches it. We've also seen Soren state in that Google Tech video that they included abstract concepts of benefits in the Civ AI for buildings and techs. For instance, the AI weighs what a Temple gives them for benefit, or whether a tech allows something special (I think the video mentions irrigation), before building, or researching, the specific item.
So, isn't it likely that they built in a similar function for wonders and techs? If the AI can consider the benefits of a tech (and likely determine when the allure of the freebie is there and when it is not, as we have seen with religious techs, etc.) before researching it, isn't it likely that they built in a similar line of thinking for wonders?
As a human, the thought process for attempting a wonder on a difficulty where the AI can compete for it is often: was I first to the tech? If I was not first, how many turns behind was I? Can I make up the lost turns of teching with my production? So for example, if we get beaten to Literature by 50 turns, we
know that getting the Great Library is a long shot, because we weren't there first, and the AI is likely building it. So wouldn't it be reasonable, instead of making the AI check the production of every city every turn, to just build in an artificial "freebie" bonus for researching techs that has to do with being first to attempt a wonder? We already know that the AI won't trade a tech if they're building a wonder from that tech; they can clearly see when a tech and a wonder are related. Maybe when they determine that an opponent has hit the tech first, the weight of the benefit of being able to build the wonder is reduced because the likelihood that someone else is producing the wonder has just increased, reducing the chance that the AI will get there in time.
Finally, one thing could contribute to the possible illusion that the AI knows when an opponent is building a wonder: often when a tech is researched, the human (can't speak for the AI here) starts building the wonder right away. Though the tech research and wonder building are clearly separate events (in that one does not necessitate the other). But if the AI considers the tech being researched somewhere else as a deterrent from building it, two seemingly independent actions are
the same thing to the AI. This may lead to the situation where the human feels the AI has avoided the wonder because they were building it, when in reality the tech being researched may be the driving factor. This could probably be tested in some way by granting techs and changing build orders to see what the AI does.
Coming back the the top and tying this together, all of that decision making could be weighted by the RNG also. Thus, even though Mansa may have be badly beaten to Priesthood and his logic says "no way, don't build the Oracle," the changed tiles that activated an RNG roll for the mine may have triggered the "oh hell let's ignore the logic and build it anyway" code.
Or all AI builds could be random and it's just selective memory (like the "combat odds are rigged!" folks). My gut feeling says that the AI doesn't know what opponents build and acts based on something like I described, but the fact that so many people have circumstantial evidence that indicate the opposite makes me unsure.
EDIT: After thinking about the Soren video again, he says that all the supposed cheats for the AI are there to make up for the deficiencies of the AI with respect to the player. Being able to see every Civ's build queues isn't making up for anything because this is not something the player can do (without espionage or whatever). It makes much more sense, again, to weight it the way I described because the AI deficiency there that would be accounted for is the ability to weigh the allure of a wonder against the likelihood that an opponent would get there first. No cheating required, just logical reasoning based on information about opponents that can be known to both humans and AIs (in most cases). Of course, allowing the AI to know the techs of opponents before Alphabet or of those they haven't met might be a slight cheat, but that's a sidebar to the main discussion.
And if anyone hasn't seen it, Soren:
http://www.youtube.com/watch?v=IJcuQQ1eWWI