There's two bugs with unresponsive units on walls. In both situations the units aren't recognized as turrets so instead act like out of world garrisoned units, i.e. they ignore everything around them (until they're attacked).
Units are considered IsTurret in UnitAI if they're garrisoned and have a parent turret.
The first situation is with promoted units, which are garrisoned but don't have a parent turret (yet; it's done on rename).
The second situation is with units placed by trigger scripts (e.g. on Jebel Barkal), which have a parent turret but aren't garrisoned.
We fix the first by cheering before SetGarrisoned (because otherwise the cheer order is ignored, and that gives time for the turret to be set), and fix the second by setting isGarrisoned with Autogarrisoned (and remove the autogarrison state).