He saw Kakashi killing Rin , right ?
But he didn't kill him ....
After that , he attacked the village to kill everyone ?

................................
His goal was infinite Tsukuyomi .... Answer me : Why would he like to kill everyone ??
.................................
Think of it this way :
I'm German .... I killed your love ... You want revenge . What do you do ?
Answer : You will kill me for revenge .... But Obito attacked the village (It's same as you attacking Germany because I killed your love

)