A. Many children have these kinds of bedtime rituals to help them get to sleep.
While some rely on or are trained to use a routine that requires a parent, such as being rocked to sleep, drinking a bottle, or listening to music, others are able to put themselves to sleep. They may rock back and forth, twirl their hair, cry a little or hum themselves to sleep, or even bang their head. In general, your child will sleep best if he is able to fall asleep on his own. That way, if he does wake up again or get into a light sleep phase, he can either put himself back to sleep or just keep sleeping without relying on a parent to help him get back to sleep throughout the night.
That your nephew rubs himself on his blanket sounds like the same thing. While it may feel good and he likely gets comfort from doing it, you shouldn't think of it in terms of getting aroused or as something sexual.
So unless he isn't sleeping well or wakes up frequently through the night, there is likely no good reason to try and get him to stop. And even if you did, you would have to replace it with another routine, which may not be easy. He will likely stop on his own as he gets older anyway.