Allowing your horse to rub his head against you is a dangerous habit to develop. Horses are so strong that what feels like a good rub to them, can easily knock a rider over. This horse head rubbing habit is especially dangerous around children and older adults and should not be tolerated.
When my horse rubs his head against me I smack his shoulder sharply. There is nothing wrong with a physical correction when a horse does something dangerous like when he rubs his head against me. Physical correction is acceptable when the offense could endanger a rider or handler. A sharp smack on the shoulder or neck will cause the horse to jerk away. In a herd environment, if a horse rubbed on another horse uninvited, they'd be met with teeth or a kick- so they'll consider a smack a light warning!
When a horse rubs against me I smack them away, then when they pull back tell them they are a good boy for not rubbing and reach up and scratch the part of their face they were trying to rub against me. The horse simply needs to learn that rubbing against me is unacceptable, but allowing themselves to be scratched and rubbed is not against the rules.