Animal production involves making choices. Animal scientists argue that the tail-docking is better than the alternative - an outbreak of pig cannibalism:
Docking tails soon after birth substantially reduces the incidence of tail biting. Pigs may cannibalize whether they are housed inside or on dirt lots and the practice occurs with widely different stocking densities. An outbreak of tail biting is expected to be very painful for the pigs with bitten tails. The small amount of discomfort caused by docking is much less overall than what would be experienced by pigs during an outbreak of tail biting.Here's another study that found that welfare was likely to be improved by docking tails - whether the pigs were raised indoors or out - because pigs with tails had suppressed immune systems (likely from fighting off infections caused by biting).
I went back and looked at the pictures of the Mangalitsa farms in Hungary. It looks like they don't dock the tails at Emőd, but do dock them at Nyíribrony. That makes sense, given that they have different systems - one less intensive.
I found an interesting book (via Google Books) about animal welfare and pig production. Most people don't know about the tradeoffs involved in pig production. E.g. it is easy to write a book about how awful tail-docking or intensive housing is, if you don't discuss the alternatives and their consequences.
Animal welfare isn't easy to define. Some think animal welfare means allowing pigs to do what comes naturally (e.g. root up everything they want to root up, or eat what they want to eat). Others point out that allowing animals to do what comes naturally doesn't necessarily increase welfare - because the increase of natural behaviors like bullying, fighting and fending off predators aren't associated with high welfare.