Happy Sunday 👍 hope you are doing well! Sounds like a new mass air flow sensor has done the trick for you which is great news!
I have a similar issue with the Freelander being absolutely fine when driving and then occasionally will go into limp mode very randomly and not even able to even move...