But a lot of dogs are rescues, and a lot of breeds are quite happy in apartments.
There are also a lot of mitigations possible. There are dog walkers and dog sitters who come by and walk the dogs during the daytime. You can have multiple dogs that keep each other company. Etc.
based on the number of dogs locked away in apartments
all day barking and bored to death with almost no
stimulation
Respectfully, it seems like you don't know a lot about dogs?A barking dog isn't necessarily distressed. In fact, they're probably not distressed: there are a lot of other ways that dogs show that.
They also like to sleep during the daytime. They sleep a lot in general. They are pretty adaptable to our schedules.
While I generally don't think we should be breeding dogs at all, the reality is that there are a lot of dogs who need homes (as well as homes who need dogs!) and in the majority of situations I think that getting dogs into homes with a loving family is preferable to euthanizing them.