If this were not the case, region owners would always get their walls.
Which they do. Line 368ff in the combat script. The two exceptions are:
- a TO is running - TO realm is the defenders
- all the region owner troops are freshly arrived, in which case they attack (and don't get the walls)
In all other cases, the region owner will be defender and get the walls.