JMA stated just:
Any bureaucracy (including the military) needs to be purged periodically... preferably in the style of Stalin.
From my reading of WW2 military history, mainly British admittedly, to a lesser extent WW1, the British can be ruthless in removing senior commanders perceived to have failed; Jim Storr's book 'The Human Face of War' cites the BEF (forces sent to France) had seventeen division and above commanders, five disappeared and six never had a field command again (one was a POW).

Another historian, Peter Caddick-Adams, has looked at lower levels of BEF command and referred in a lecture a few years ago that defeat in May 1940 helped the British Army evolve into a fit, fighting force. When questioned on this he attributed this to the physical and mental collapse of many commanders faced with the Blitzkreig, those taken POW and "weeding out" upon return.

This "weeding out" continued to 1945, for example General Anderson, who commanded an army in North Africa, Operation Torch and then effectively never commanded again:http://en.wikipedia.org/wiki/Kenneth..._Noel_Anderson

I know Red Rat has looked at this issue too and has more books than I on this.

"Weeding out" can happen in the UK police too, usually far less public and an academic who studied the RUC noted that after an external review in 1969, a third of mid-rank commanders were retained, a third told to retire and a third encouraged to move - to the mainland or the colonies.

The current PM, David Cameron, has publicly indicated the police service needs a new generation of senior leadership, even from abroad or the military. Bill Bratton, ex-NYPD & LAPD, cited as his preference for the next Metropolitan Police Commissioner. See:http://www.telegraph.co.uk/news/ukne...-applying.html

I wonder if any of the military committed in recent wars have seen weaknesses before or during deployment?

Stalin's purge model is not one I'd follow:
At the end, three of five Soviet Marshals, 90% of all Red Army generals, 80% of Red Army colonels, and 30,000 officers of lesser rank had been purged. Virtually all were executed.
At first it was thought 25-50% of Red Army officers were purged, it is now known to be 3.7-7.7%.
From:http://en.wikipedia.org/wiki/Case_of...y_Organization