I'm going to answer your question as asked.
It doesn't need to be exogenous. In fact, it's often not exogenous at all. The truth is, vitamin D can be (and is) be synthesized de novo in adequate amounts by most mammals exposed to sufficient sunlight.
Now, obviously, the presence of the correct wavelength of UVB simply allows the reaction to proceed at a reasonable rate. But the first misunderstanding is that calling "cholecalciferol" a vitamin is simply a misnomer. In reality it is not an essential dietary factor. As you allude to, it's better to consider it a hormone.
You next question is "why does not evolution not select out Vitamin D in favor of endogenous chemical or nothing at all?" Again, answering this question:
Vitamin D is an endogenous chemical!
It has been in many organisms for millions of years! And very useful too. Ergosterol, previtamin D2, and its photoproducts could have acted as an ideal UVB sunscreen since they could absorb UVB radiation and dissipate its energy by the rearrangement of the double bonds.
Of course, the photochemistry of vitamin D is important and the synthesis in the body is very dependent on a variety of factors. Firstly, environment and the incidence of solar radiation with wavelengths of 290–315 nm on the skin. Other factors include the zenith angle; nitrous oxide, ozone sulphur dioxide pollution, altitude, sunscreen, skin pigment, aging, latitude, season, etc.
It's vital for maintaining the skeletal calcium balance by promoting calcium absorption in the intestines, promoting bone resorption by increasing osteoclast number, maintaining calcium and phosphate levels for bone formation, and allowing proper functioning of parathyroid hormone to maintain serum calcium levels. 1,25-dihydroxyvitamin D influences a large number of biologic pathways. Hence rickets, etc.
One thing to be aware of is that vitamin D either from endogenous synthesis or the diet must be biologically activated through enzymatic hydroxylation in the liver and kidney.