I had the problem of the 5 speed shifter popping out of first gear on my D6. I was unconvinced when everyone here told me it was probably because of the slop in the main clutch and linkage to transmission lock mechanism.
So I did a test with the tractor stopped, engine stopped too....
with transmission in first gear (my problem gear), I engaged the clutch and then pulled on the gearshift to try to get it to pop out into neutral......it did not, no tendency to move toward neutral at all. So I knew I had a functioning lock on that shift rail and the problem was elsewhere.
Next, I kept up my hard pull on the gearshift and simultaneously pushed the clutch lever forward. There was a lot of slack in it and about time all the slack was taken up, suddenly the gearshift slipped into neutral. My solution was actually pretty simple, I just adjusted the linkage between clutch lever and lock lever on the side of the transmission. That saved a lot of reworking of the internal clutch release mechanism where most of my slack seemed to be.
When I got it right I knew it was right because I repeated my test and the clutch popped out (released) just befor the transmission unlocked and allowed the shifter to move out of gear.
I would try a similar test before I did much tear down on your transmission. It’s possible the reverser gears on yours have enough wear that they tend to shift under load unless the lock is secure. As I said mine was first gear and while I’m sure it has some wear, once the lock was functioning properly, I never had any more trouble
D2-5J's, D6-9U's, D318 and D333 power units, 12E-99E grader, 922B & 944A wheel loaders, D330C generator set, DW20 water tanker and a bunch of Jersey cows to take care of in my spare time😄