I think definitely his loneliness had something to do with it. Of course he had Hashirama and his clan, even the village, but it just wasn’t enough. He just couldn’t let go of what happened to Izuna, for one. If Izuna hadn’t died then he wouldn’t have felt so anxious and pessimistic about the village, I think.
I don’t think his loneliness can necessarily equate to not having someone to care about, per se. Like, I guess if you’re referring to him having a s/o and whether that would have helped him, I really doubt it. I think from the moment Izuna died and the village was formed, Madara was going to go down the path he did regardless. Even if he had someone to care about, the underhanded shit Tobirama was doing to the Uchiha, and the pressure from the Senju becoming the ‘hegemonic’ clan in Konoha, was still going to bother him. Madara was just too pressured and provided with too many points of doubt for him to really stay in Konoha and keep the peace.
Even if he had someone to care about, the Uchiha clan was still his priority. He promised Izuna he would protect the clan but in Madara’s mind, it didn’t look like that would be possible with the way things were going in Konoha, so he would have cut ties and left anyway. Idk, that’s just what I think. I don’t think there was much anybody could do to stop Madara from going down the path he did given the circumstances