@Mik1984 I analyzed your game.
There are 60 major AI cities on the map (no Russia, no minors). They have 23 walls in total. So, first of all: AI knows how to build walls. There is nothing stopping them.
Now the breakdown.
Have walls: Netherlands - 5/7, Cree - 5/7, Phoenicia - 9/10, Australia - 2/3
As you can see, AI can build walls, pretty fast.
Started: Arabia - 1/5, Macedon - 1/6
Arabia has 20 techs, but Saladin goes via upper tech tree - Sailing, Selectial Nav, Shipbuilding. Just started building them.
Alex - probably too busy buidling units.
Don't have: Indonesia - 0/7, Greece - 0/4, Inca - 0/11
Two of them have barely finished Ancient Era (or are about). Indonesia - 11 techs (actually, no Masonry here), Gorgo - 11 techs (also no Masonry). No walls, obviously.
Inca is a little mysterious. Pachacuti has 25 techs, so obviously science is not holding him back. But if you look at his geo situation: he has 8 (eight!) friendly civs, he has its own continent, only has borders with 3 city-states, plus he has pretty strong military (top 3 in the game). I suppose he simply has no reason to build walls. I checked his build queues and he basically goes heavily for expansion, military, and infrastructure (districts, Settlers, Caravels, Markets, X-bows, builders, Libraries, etc.)
I also checked Alex. He goes for 2 wonders, trader, and a Settler. ALEXANDROUPOLI has Walls scheduled however. Alex has researched top of the tree (Shipbuilding, etc.) so I cannot say when he researched Masonry. Could be not long ago.