... how come Neil Armstrong and Buzz Aldrin failed to employ basic infantry tactics while walking on the moon?
Because there was no anticipation of encountering inhabitations? Unlike with Starfleet.
Thank you T'Girl!
As history within TOS and beyond has proven, sensors showing no signs of life (or danger), and even reason and logic showing no signs of life (or danger) are not by any means totally accurate.
As a captain (or anybody responsible for the actual lives of human beings), if there is a chance of your men dying, at least basic caution should be practiced.
Of course, when it reaches a point where general safety is established beyond reasonable doubt (ie. after they determine a life form or civilization to be friendly, and so on), it is silly to walk around ready for battle at all times.
Here are two episodes where tactics could have saved lives (you'll recognize them, I'm too lazy to look up the names

)
1) The episode where a gas-based life form is on the surface, that envelopes poor Redshirts and ultimately kills them. If they could have seen it coming, they could have maybe beamed up. Or ran away.
2) "The Galileo Seven," the episode where Spock, McCoy and a few others are ultimately stranded on the surface of a planet. A Redshirt wandered off and was killed by the monster! What an idiot. They're stranded on a planet ... so they split up?
I'm sure there are a few other episodes I fail to remember at the moment.
The only reason I could think of for the lack of tactics is the possibility that Star Fleet member by then had essentially transcended violence and the need to fight, to the extent that such tactics may have not even been taught at the academy.
Another thing I don't understand is why their teams were always so small. Kirk, Spock and McCoy should have had at least two Redshirts at all times just in case something got nasty.