Causes for failure to stay in selected gear
The causes for this are always, always one of the following:
The gear is not fully engaged. This can be due to external linkage, mounts, etc. or internal clearances allowing the shafts to walk fore and aft.
Wear on the mating surfaces of the speed gears and shift hubs. Which side is worn, power or coast, will determine whether it pops out under accel or decel.
That's it. I respectfully suggest that synchronizers will not cause this condition, ever. If ring replacement seems to repair this condition it is because the real cause was addressed while the box was apart.
Send a message if you need help inspecting internal parts. The wear you are looking for is not always obvious. I needed some coaching to spot it the first time. Good luck!