Track roller lower guards do assist with keeping the track on - but you need to check track frame alignment and idler alignment.
The idler can get "cocked" in the track frame via a bent idler pushrod. This happens when operators run into big rocks or stumps or big logs at speed, the impact on the idler bends the pushrod.
Then you need to check track frame alignment. This is easily enough done by running a tape across the back and front of the tracks, measuring C to C, while the tractor is on level ground.
Any more than about 12-15mm (1/2" - 5/8") difference in toe-out will increase track wear and facilitate tracks walking off.
The track frames get out of alignment via worn outer sprocket bearings (bushings), bent diagonal braces, worn diagonal brace (inner) bearings - and even bent track frames! Yes, you would be amazed at how much track frames can get distorted with bends and buckles.
Alignment of carrier rollers is important, too. To align the carrier rollers, idler and sprocket, you hold a string line across the top of all those components when the track is off.
Finally, idler guides and wear plates must be kept in good condition, as any wear in these areas puts the idler out of alignment with the rest of the track and encourages tracks to walk off when conditions become adverse, such as sideways on steep slopes.