Personally thought it was Shogun's speed causing Machida problems more than leg kicks or anything. Shogun was beating him to the shot - something I haven't seend before.
It's the speed and also Shogun's unorthodox style & timing, the strikes don't come in when Machida thinks they should and the angles are a bit funny as well. Machida has blinding reaction speed, but also needs to anticipate when the strikes are coming in to time his counters, it's his anticipation which makes him such a deadly counterstriker.
Against fighters with more conventional styles such as Rashad or Thiago Silva, Machida can get their timing & body language figured out so even with a fast fighter like Rashad he can anticipate the strikes and effectively counter them.
Against Shogun he had to rely almost solely on his reaction speed, he had a lot of difficulty trying to anticipate when & what Shogun was going to do to him. On top of that, Shogun came in with a great plan to take out his legs and slow him down some more. Up until Shogun, everyone was trying to punch or kick Machida in the head which is about the dumbest thing you can do given Machida's stance & style. He wants you to try and take shots at his head because he knows it's damn near impossible to connect, and if you miss it's a left straight to the face from Machida. Shogun was smart and worked over Machida's legs & body instead, hit the targets that you can hit and worry about the head later.
It's a refinement of the strategy he used against Chuck Liddell, take out the legs to take away the movement & power, then hit the head when you have the chance. Shogun opened that fight with a legkick and a couple minutes later Chuck was limping around the Octagon, a few more knees to the legs in the clinch and Chuck's power was gone, after that it was all over.