It is dubious, but I wouldn't absolutely rule out the hat edict as having a purpose. Remembering to wear something on your head is definitely an acquirable muscle memory.
> like the part where if you're walking with someone, the senior ranking person is on the right hand side--what, do you get shot at more often from the left hand side?
This example, on the other hand, probably is the result of conscious, practical decision making. You are better positioned with your sword arm free. It seems reasonable that the senior ranking person would insist on walking on the side that allowed them to have their sword arm (pistol arm) free in case of attack.
You can build a ramp around a tower in two ways. One direction puts your right hand on the side open to the air. The other pins it against the tower wall. Towers were built so that the direction of the ramps encircling them allowed defenders at the top to have their sword arms free to the open air. Attackers coming up with the ramp would have their sword arms inhibited by the face of the tower. You can verify this by inspecting the construction of the towers.