Elsa created Olaf. As his builder, part of her personality went to Olaf (likewise, the other characteristics that she ingrained in him). It’s very possible that Olaf stands for the innermost longing of Elsa’s heart. That is why we can all see how much Olaf loves Anna and how much he tries to protect her the same way that Elsa would have. Moreover, Olaf would display the same feelings as Elsa.
Elsa has always wanted to be near Anna. But, because of the curse, she had to stay away from her. For that reason, Olaf can always be seen around Anna.
Elsa and Olaf have the same belief about love. They both know that love means sacrifice. Notice the funny reaction of Olaf when they were on their way to Hans to save Anna? He was very stunned that Anna’s true love is someone he hasn’t heard about. That’s not far from Elsa’s belief that Anna couldn’t marry someone she just met. Later on in the movie, they both have the same surprised reaction when they realized that love is the answer she needed to thaw the ice and to bring back summer.