If was never clearly stated, IIRC, how long a force ghost can maintain its form/communicate.
Sure, Qui-Gon Jinn was later added to have taught Yoda how to join the force upon death.
And how much training did Luke do on his own, between Episodes?
How much was Luke taught via the intuition of the force? How did he know where to get a kyber crystal to make a lightsaber, and how to make a lightsaber?
Otherwise, why did we not have a ghost jedi army, like the one we see in The Lord of the Rings: Return of the King?
Sure, having Yoda allowed them to create plot devices, and allowed Luke to see what could happen if he falls to the dark side (encounter in the tree).
Before this, how one became a Sith was not revealed.
I don’t think the force alone could have taught Luke that lesson.
It also showed that in a universe with many non-human species, non-humans can also be a force user, and that size does not matter… do or do not, there is no try.
Also, it helped with having a known character and fill in its backstory (just like Obi-Wan Kenobi – failure with Vader, etc) when they made the prequals.
It created a built in curiosity for the fans.
What was the Clone Wars?
How did the Emperor gain control of the galaxy?
How did Kenobi get the rank General?
What lead up to the fight on the lava planet (and the fight itself)?
If we did not have a Yoda to train Luke, give him the fundamentals so he can learn more on his own, we would get…
The Mary-Sue that is Rey.
So given the choice of having now one to train you (Rey) or having someone (Yoda training Luke), I would pick Yoda option every day.