How can a ceiling fan be mounted to a fan-rated box that has been extended?
422.18 paddle fans shall  be supported independently of an outlet box Or by a listed box or outlet box system identified for the use and installed per 314.27.C.

There may be listed box extensions out there for paddle fans but I have never seen one. To be code compliant the better route to take with a paddle fan that has more conductors than the box fill allows would be to add a second box. If the ceiling (attic) above the fan is accessible this would be fine. If the ceiling (2 story fan on main floor) above the fan is not accessible a second box could be cut in and a cover plate attached after being wired.
After seeing the damage done to the electrical system and home when a DIY home owner incorrectly installed a nice fan I would strongly recommend making sure the fan support box is listed for the weight of the fan or more.

An additional code reference for those hanging chandeliers weighing more than 6 Lbs. If a luminaire  weighs less than 6lbs it can be supported on other boxes or plaster rings with no fewer than 2 #6 screws 2014 NEC 314.27.1 exception 1. (even a simple light fixture weighing more than 6lbs requires a listed box).