AI: Refactor defender selection not to depend on wall consideration
There's a dormant bug in military_advisor_choose_build() that also the latter-than-first defender unit selection is within the "if (build_walls)". It has not been causing trouble as build_walls has always been TRUE, except when there's already a suitable first-defender chosen. (So maybe it's on purpose, just with badly named gatekeeper variable)
This is one of the things causing trouble in attempts to solve #45276. While the refactoring could be done as part of #45276, I'd rather do it separately first, to keep steps small and well independently tested.