There is no single reason for toxic plants to be as potentially dangerous as some of them are. They are toxic by various means, and to various degrees. Some actually seem to be incidentally toxic. Many are intentionally and justifiably toxic. A few live in home gardens and landscapes. Of these, a few surprisingly produce safely edible fruits and vegetables!
Immobility is a major disadvantage for plants. Those that begin to grow where resources are inadequate are unable to relocate to more accommodating situations. Those that live within ecosystems that periodically burn must either regenerate efficiently after fire, or be resilient to fire. Flowers of all plants must rely on other organisms or wind for pollination.
Since plants are immobile, they can not evade other organisms that eat them. Therefore, some do what they can to be unappetizing for the organisms that are most threatening to them. Some use thorns or similar protective devices. Unpalatable tomentum (fuzz) works for others. Many use unappealing flavor. Some are unappetizing because they are toxic.
Toxic plants are generally not toxic to a broad range or organisms. Insects eat plants that are very toxic to mammals. Onions, although commonly consumed by humans, are toxic to canines. Fortunately, most organisms instinctively know what plants are toxic to them, and avoid eating them. Unfortunately, humans and canines are occasionally exceptions.
Because young children put random items into their mouths, and puppies chew anything that they can get their teeth around, they should not have access to toxic plants. Morning glory, foxglove, yew, oleander and castor bean are some of the more poisonous of plants that are common in home gardens. Dieffenbachia is a potentially dangerous houseplant.
African sumac and smoketree are related to poison oak. Although not so poisonous, they are incidentally toxic allergens to those who are sensitive to them. (Incidental toxins may not be intentionally deterrent to consumptive organisms.) Hellebores are both poisonous and very allergenic. Poinsettias and their relatives are toxic because of their caustic sap.