You've raised some really interesting questions, OP. Breeding raises a host of ethical questions, which any responsible breeder has to consider. You can start with the health issues associated with particular breeds. I genuinely think dogs such as Cavs, Bulldogs and possibly Pugs are so malformed and prone to such health problems, I genuinely can't see a way forward for the breeds. The latest research I've seen has been looking at "air hunger" in brachycephalic breeds and the welfare implications and it's horrible. Yet you still find people who think pugs gasping for breath is "cute".

Then there's the wider, macro issue of the number of dogs, and the problem of strays/unwanted dogs. Then there's the issue of what you do with unwanted breeding bitches, and any surplus/returned pups. Poorly socialised pups (like those from puppy farms) are more likely to have behavioural and health problems.
Regulation and inspection - many puppy farms are licensed and local authorities (especially in Wales) are quite happy to issue licences for dreadful conditions. KC inspections for Assured Breeders are very lax, and in fact breeders are getting their accreditation without any inspection at all. There have been some high profile prosecutions of Assured Breeders for welfare issues and anecdotally, I've heard some really hair raising stories about how pups are raised and bitches treated at AB premises.
Untaxed income - for BYB who are willing to cut corners, this is the driver. Say you have a litter of 6 pups and you sell each for £500 - the income is £3K. OK, you might have a few extra expenses but let's say you've avoided health checks, and you've just had to pay for worming, and some extra food. Generously, you've shelled out £500, so that's still £2.5K you've got untaxed. For families who are on low income that's very attractive money. I know one person who used to fund her DC's birthdays and Xmas off selling pups. If you've got a couple of bitches, that's enough for a decent holiday each year, or a very tidy car.
I love the idea upthread of breeding for temperament and "real world" checks. Don't forget that for some breeds, the KC is not the breed registry. For instance, all racing greyhounds have their details recorded and generally they have superb temperaments in terms of being handled. They are also bred for performance, not for looks, and greyhounds have long used techniques like the import of frozen semen so the COI is very low for the breed and for large dogs, they are healthy and long lived, something the KC has been very slow to take on. My understanding is that on the Continent, some working breeds are judged on both looks and performance , and for gundogs this is also a factor too.
We also have to address the elephant in the room whenever breeding is discussed - there is a huge amount of snobbery and class association wiht certain breeds, and with the issue of buying a pup versus getting a rescue. Some people see paying £s for a puppy as a status thing, and wouldn't dream of getting a rescue dog in exactly the same way that a confidently middle class mummy will cheerfully boast of a charity shop purchase (ticks all the boxes of being green, thrifty and charitable) while someone else will see a "second hand" item as being less valuable and tainted. For most families, who simply want a nice pet dog, a rescue will offer everything they could want - I do accept that for a few specialist roles such as working gundogs etc. there may be a role for specialist breeding/pups but that's not really what most dogs do. But until we change the perceived "value" of rescue dogs and encourage people to see the real cost behind many pups, I'm not sure much will change. Puppy farming could stop tomorrow if there was no demand.