I can understand why he would attack Konoha even though the motive wasn't outwardly stated, but I have absolutely no clue as to why he would aid in the massacre of the Uchiha. It couldn't have been to repay Madara for saving him, since we all know that Obito detests Madara, It seems that Uchihas would still be effected by Infinite Tsukiyomi, so why would he aid Itachi in it?