I didn't have the same experience. I saw several cities with walls being taken by the AI.
Also, why did you add so many irrelevent stuff in your "tests"? Test 1 is useless, if you really wanted to mention it just say "I made two tests, but missed the first one, and in the second one the AI took 20 turns to enter an undefended city."
Which is still only one occurrence.
As far as we know, the AI in defensive wars while having an entirely different goal may have "conquer enemy cities" in very low priority. It makes sense to target enemy units first and keep defensive armies just in case someone rushes to stop you while you're going for science victory. Maybe it's just an occasional bug. In any case, hard to say with just one test.
But people need to stop doing like if their favourite game in the series had the best AI, especially the 5... If you're in love with Civ5 just play it, nobody will blame you for that. But at least acknowledge your personal bias.