Okay, so here’s my theory. Everyone keeps going on about how Tony Stark created Utron. But keep in mind his mental state at the time and the presence of outside interference.
Tony was already confronted by his worst nightmare when Wanda invaded his mind. Then, already vulnerable, he spent days in contact with the Scepter, which has already been established as having the ability to alter peoples emotional state in The Avengers. In a deleted scene in Age of Ultron, Thor clarifies that the Scepter brings out the monsters in a persons mind.
So Tony, already vulnerable from facing the vision of his worst nightmare, spends an extended amount of time with an alien device that brings out the darkest parts of the subconscious, affecting his judgment and fuelling his desperation to protect the world and the people he cares about.