Maybe you could try explaining to him that he shouldn't use his hands to check - that grown up boys go to the toilet to see if they have done a poo.

If he isn't doing it at school then it sounds more like something that he can control when he wants to (the hands in the pants thing I mean)

It must be terrible for you both.