Because that is the way Prime is/was. He cared for all beings, including Megatron. Hence his decision to sacrifice himself destroying the Allspark, rather than kill Megatron and destroy the Allspark.
Yeah. That's why I kind of liked it. I mean, he died for all his little Autobot friends in the old movie. But dying for someone that wants to kill you? Pretty cool.
Or Prime just has a Messiah complex.
"You're either lying or stupid." "I'm stupid! I'm stupid!" Megatron and Starscream