Pentagon officials are attempting to stay on the sidelines of an intensifying feud over annual defense legislation that has highlighted the military’s vulnerability to being pulled into America’s most divisive social issues.