In 2012, there were a lot more possible forces that could intervene if someone screwed with Earth. Note that Asgard was still intact and at the height of its power, and Earth is claimed by them as one of the Nine Worlds. The Order of Kamar-Taj is still lead the Ancient One. The Nova Corps has recently ended their long war with the Kree, and hasn't had their forces decimated lately. *cough*
Basically, moving publicly and openly against Earth would run the risk of having all kinds of forces powerful enough to give Thanos pause land on their head. Whereas if you use a patsy like Loki or Ronan, the worst you lose is some expendable resources given to bump up your pawn.
Note, by contrast, that when Thanos did make his big move, Asgard was kablooey, the Nova Corps had been eviscerated just a few years earlier, the Ancient One was dead and Kamar-Taj weakened, etc. Everything was in a position where he could start snatching up Infinity Stones without the traditional big power centers acting.