In order to produce hens, you're producing roosters. You either need to keep an equal number of productive animals as non-productive animals (and keep them separately, or your hens will die from *ahem* overuse), or do something with the males.
In order to produce milk, you're producing calves, including both male and female offspring. Again, you'll need to do something with the males, and pet cows are a LOT more expensive than pet chickens.
I am not going to get into the treatment issue, because there are farms which treat better or worse. But if you believe that causing another creature to be killed is bad, dairy and eggs still do so, albeit indirectly.