...and when Trinity dies... he have lost love so he wants to finish his consciousness and made up all about the self-sacrifice in his mind, the consciousness. Before Trinity dies there's no possible solution to the War with machines.
Trinity dies just after seeing the "real" sun. That may be the love act of Neo or so. Once his consciousness thinks he has made it feel to Trinity he ends everything, killing Trinity, the War, the Matrix, and himself.
I still don't understand it much, lol. 2001 Space Oddissey had a book, I read then I understand.
The Matrix: Revolutions, Explained
Here's a online interpretation. I don't have time to read now. But the Christ crucifixion paralelism is obvious.
He has done his mission in the world, so he dies.