Really, one mine gives you 4-6 hammers per turn? That's pretty incredible, considering a plains hill mine yields 4 at max. And you'll already be working metal deposits, so don't mention that, unless you somehow have 2-3 metal resources in a single city (in that case, that's just dumb luck). And unless your mine also gives you 1 commerce, you don't lose anything in terms of research and tax money by whipping.
And I think you are off for the unhappiness due to whipping on epic speed...I don't remember exactly what it is off the top of my head, but I thought it was 15, not 20.
And you don't let a city grow to unhappiness, ever, if you can avoid it. You whip the turn before it grows, and then grow back to your original size. Also, that has the benefit of maximizing your food income because you don't have unhealthiness (your population is low). If you play on a lower difficulty level, then all this will seem pointless because you receive so much in terms of free happiness and healthiness. Although, I think, you'd be hard-pressed to find a successful Emperor player or above who doesn't whip and chop (not discussed here, but another form of quick production) judiciously.
Also, there is the issue of initiative--by whipping out troops early, you will have a brief advantage in military strength (or on high levels, a brief "not so weak" moment in strength because the AI receives huge bonuses). The exploitation of that advantage is crucial, but it leads to long term rewards. Especially if you take a warmonger approach, hitting the AI hard and often is essential and your top priority, and you can start earlier with whipping.
What's a good post without a case study? Here's a picture from a game I won a month ago or so; I used this same picture to defend whipping and chopping in another thread where someone not experience in the ways of beating your people into submission suggested the same thing you did:
Notice how unproductive this city I culture-flipped from the AI is? (Don't mention those tiles off to the right, those are taken by a more important core city.) You know, though, at 2 food, 3 commerce those coastal squares could really be effective in boosting my economy...but I need some improvements...
Here's an idea. I let the city grow to size 4, and then I whip the building I want so the city falls to size 2. I gain 9 food a turn here, 11 when I whip a lighthouse, so the surplus maxes at 11-4 = 7 food per turn. On epic speed, it takes 45 food for a city of that size to grow, and at 7 food per turn I fill that in 45/7 = ~6.5 turns. After a granary, 45 / (2 * 7) = ~3.2 turns. And yes, because the new citizens can work 2 food tiles, this holds until the city grows to size 5 (as pictured).
Now for the fun part, if I whip 2 people, my city still gains 7 food a turn, and will replace both within about ~6.5 turns after the granary (the first thing you whip, followed by a lighthouse here).
Look at the hammer output as well...90 hammers for whipping two people, with a 6.5 turn replacement time.
That's ~13.8 hammers per turn without any mines present! Even if I had two mines, or even iron supplies on those two squares that it neighbors on the right, I could only get ~8 hammers per turn from them!
Now, you are going to say "but that's a commerce city, and you won't produce any commerce by whipping because you won't be able to work those coastal squares and cottage!" True, but by whipping out a granary and lighthouse to quicken my growth time, I will be able to whip a library, marketplace, grocer, maybe even a bank/university and then let the city grow. In the long run, that city will come out ahead in terms of commerce so long as the game doesn't end too quickly (which it didn't).
The thing is, you only have to find a city location with 2 sources of food to make this work. And with livestock such as sheep and pigs, the farm resources like corn, rice, and wheat, coastal resources which can be boosted by a lighthouse, and even sugar (a plantation resource)--there are plenty of opportunities to make this trick work. And you will get more production than by working a mine or two (or even 3). And if you have 3 food resources, which are more rare but still possible (my capital had it once...), it's even better!
And as for happiness, with hereditary rule, 4 happiness resources, a temple or two later on...you can prolong this whipping phase for awhile, and have over 10 happiness in this small town while your whip-induced unhappiness approaches a figure like 8 or 9 when you are at size 4-5. Then, you cool it for ~10 turns by running some specialists in all those buildings you just whipped, then start all over again!
I'm not going to say it is easy, but if you do manage it properly, there is a much larger benefit than what you suggest. And this is why slavery is not a useless civic--any civic that can turn an otherwise unproductive 2 hammer city into a ~13.8 by whipping along (14.8 from the city square, not counting that forest hammer but it's there too, part of the time...) is not useless.