He didn't lose because of his attitude. He had the attitude because he was losing - i.e. not executing the plays the way he wanted to.
Fair enough, but you gotta keep your cool. In that match, Raonic had plenty of chances to choke, the 3rd set especially. But Raonic got a mental boost every time he won a point cause he saw Murray losing it on the other side of the net. Raonic's mind: "Keep going, keep going, you've got him, don't let up, he is cracking," whenever he saw Murray acting like a baby.
I recall when he played Federer close a couple times earlier this year, and Fed gave him nothing mentally. The same point where Raonic would win vs. Murray and get a mental boost cause he saw Murray losing it, he would get nothing from Fed. Fed was able to take punches and keep his composure. This put more pressure on Raonic knowing that he'd have to come up with the goods time and time again. He didn't get any extra mental boost from winning the point.
It is these little things that make the difference.