Why are there so many medicinal plants?
Perhaps the question may also be phrased, "Why is it common for plants to produce chemicals that possess pharmacological or toxicological effects in man and animals?", and to that question it is often reasoned that plants, being sessile and otherwise defenceless food sources for predators, produce compounds that affect the physiology of animals in such a way as to make it not beneficial for a predator to consume them, which is close to your 3rd hypothesis. Remember that pharmacological benefit is largely anthropocentric, and relative at that. For instance, a plant compound that lowers blood pressure could be used as treatment of hypertension, but if the plant were to be consumed in its native state in appreciable quantity, it could put the eater into shock, cardiac arrest, etc.

Most pharmacologically active compound from plants comprise a class of compounds known as secondary metabolites: metabolic intermediates that are not appreciably involved with functions of growth, respiration, etc. (often interpreted as evidence for a defence mechanism). 

Try this wikipedia article and see what you think: http://en.wikipedia.org/wiki/Plant_defense_against_herbivory

The major classes of secondary metabolites in plants are: terpenes, which are polyisoprenoids, phenolic compounds, including the polyphenolic compounds, which are a popular study in natural products research, and alkaloids (along with other nitrogenous compounds).