it's madara ofcourse. . obito was simply doing wat madara told him to. .
But if Obito would have betrayed Madara the moment he disconnected from the Mazo and went back to his village,then this war would have never happened,and having Madaras knowledge he could have protected the Uchiha clan and the village from other threats.