I actually live in a rural area and have spoken with several neighbors who own chickens, including a farm who sells cheaper than the grocery store.
you'd see an increase in backyard chickens because it'd become a very viable business to undercut the grocery store.
Well, maybe that's why you missed city people's perspective and why eggs can be expensive in grocery stores and still get buyers.
I live in dense city center apartment so owning chicken at home is very hard. They smells and make sound, which will get plenty of complaint from neighbors. Even large dogs are not popular choice as pet here, let alone chickens exist only for eggs.
I have friends who owns chickens in rural area, but driving to his farm and come back takes 2hr. On the other hand, I can walk to super market for eggs within 5 min.
So even if rural area farms undercut expensive grocery store eggs by a large margin, it is still "cheaper" (if you consider time = money) than buying more expensive eggs in the city. I am totally willing to pay $10 to middle man to save 2 hr of my time. My wage worth more than that.
So is why you can't just undercut grocery store in the city and always win. It works for people living in rural area but not everyone.