I understand that the rank in war is determined by defense levels, but does it have anything to do with the layout and design of the base? Like if you and someone in your clan had the exact same defense, hero, traps, etc. levels, but one had their buildings randomly spread out in the area, and one had a good solid base with walls around it and the usual stuff, who would be higher in the war?
No, the layout of your base does not effect your ranking in war.
Your war ranking is dependent on your buildings and soon it will also be dependent on troops as well.
There is no way the game could calculate what is a better bases and therefore no way it could rank this. Plus, people change their base during war prep all the time but it can not effecting their ranking.