To venture a guess (or another way of thinking about it): Maybe it evolved from a fungi which infected a lot more different plant species before. But this combination proved to be the survivable strategy since all the other plant species died out or developed defences... I think it is easier to think about "how did it survive" than "what is the advantage". Unfortunately there is only very very little fossil record of fungi, so it might stay a secret how it became what it is today 😃