The game builds buildings irregardless of names i believe, and does it based on the benefits each building gives. For instance in RTW if there was a gap in the recruitment tree for instance and the 4th level of barracks gave nothing new compared to the 3rd, the ai wouldn't build it.

And some buildings have 7 levels to them.