My one horse was rubbing his tail even after extensive deworming including a power pack. I had an older tube of ivermectin. It had expired 3 months before so not too old. I rubbed it under the tail and around his anus and that seemed to work. I read that on COTH as another treatment for pinworms.
Slightly off topic please look into fecal counts to determine when and what to use to deworm rather than just rotational worming on a schedule. Rotational worming is leading to drug resistance. Many times people are using products to don’t really work in their area any more due to the resistance the worms have built up to that product.
If he is wearing a blanket could the tail flap be rubbing the top of the tail or causing him to be itchy?
Sometimes geldings that need their sheathes cleaned will rub their tail.