See attached. I tested it briefly, and it works. If you have any problems, write back.
This will work with Quo's Tweaks, but, in order to do so, it deletes the PrereqTech and BuildingPrereqs values for walls, so it will break the tie between walls and the encampment district. You'd be able to build walls without barracks/stable in any city. Also, note, it deletes PrereqTech (Masonry), so walls no longer require Masonry to be built. I don't see an easy way in XML to retain these prerequisites and still have walls at the very start. I can do it in Lua, but that would require a bit more work.