How does LEGO handle the breakage of Hero Factory sockets?
Each time I've heard someone from LEGO speak about quality, they tend to insist on on simple message: they can't do anything on a problem they don't know about. This may seem very obvious, but they feel it needs to be repeated anyway.

What this means is that they want every single customer with any quality problem to actually report it. Apart from the fact that they always help customers directly, they record all of it and the number of times a problem is reported is also a good indicator for LEGO that the problem is serious and needs to be addressed.

A simple example: instruction books and sticker sheets regularly ended up bent or damaged. Through the number of complaints this generated, LEGO has learnt about the problem and how seriously it was perceived by its customers. As a result, instructions and sticker sheets are now packaged (manually, I might add, which has an extra cost) in a sleeve with a cardboard to protect them, at least in bigger sets (again, because of the cost).

So, in a nutshell, that's the most important thing LEGO does about all quality problem: they listen.

I have no way of knowing myself if that particular problem of ball joints in Hero Factory figures is very widespread or well known, but the more people report it to LEGO, the bigger the chance it's going to be solved. And in the meantime, everyone who contacts them will get replacements anyway.

So I would advise you to just follow that route: each time you get a broken part, go to the LEGO customer service Replacement Parts page, select "a piece broke while building", type in the set number and select the part which broke. You'll even get a chance to enter in detail what happened. So you'll get a replacement, which solves your immediate problem, but in the background LEGO might learn that this particular part is too fragile if a lot of customers report the problem.

One last thing which needs to be said is that even if LEGO is aware of a problem, or addressing it, or maybe already solved it, it may take time for the solution to reach the public. A new, enhanced version of a part might not appear in sets before the stock of the other version has been used, for example (unless the older version is so bad that LEGO will recycle the stock entirely, of course, but that probably doesn't happen too often).

Note: I apologize if this answer is very generic in nature and doesn't address the ball joints specifically (thus no answers on the "are there way to prevent this" part, although I guess a little bit of soap might help), but I feel it's very important to understand how LEGO deals with quality problems in general.