While I definitely would not advise doing it, it is perfectly legal to euthanize a healthy dog within the United States. Sadly, this is something that is done regularly.
“
In general, yes, vets will euthanize dogs that pose a danger to society. However 99% of cases are due to lack of training and a good vet will refuse to put a dog to sleep.
If, for example, they feel that a dog has a treatable medical condition, they would discuss with the owner what treatment may entail. They will also refer the owner to any helpful resources or organizations that can assist.
Interestingly, some vets in a study reported that they had felt pressured into putting a dog to sleep by an owner or another vet when they may not have felt it was the right decision.