Worn dogs on the gears, bent or worn shifter forks and worn cam plate fork roller groove in that order - Or worn fork roller groove, bent or worn shifter forks, or worn gear dogs in that order... It is the chicken or the egg.

The dogs on the gears are straight cut, and when they wear a bit, they can be prone to wear some more finally ending up with the bike not staying in gear. They typically put a lot of pressure on the shift forks and cam plate when they "blow" apart.

Now it could have started with rusted or weak shift plunger springs in the inner cover, or a worn, sticky or weak cam plate detent plunger or it be as simple as just too much testosterone and a sticky tire.