Expanding the history of collars a bit since it comes up often. You see these developing from [small bands around the neck[(http://collections.vam.ac.uk/item/O115767/shirt-unknown/) as an easy way to finish off the raw edge of the opening. King Louis IX's surviving shirt from around 1250 is possibly the oldest surviving undergarment and has a narrow rolled hem around a wide v-neck instead. By the time we reach the 16th century (and portraiture is detailed enough), it's easy to spot narrow banded collars. /u/KittyDentures covers this much better in When Did Shirts First Start Having Collars? Since shirts were used as the main undergarment up until this time, they were worn and washed often. Thus when fashion was for lace collars or ruffs, they were either separate pieces or meant to be unstitched, washed differently than the shirt, and reattached. By the late 18th century basic shirts were mass produced to such a level (even though they were hand-sewn), that they were usually sold in packages of 6 or 12. Not too expensively since they were made assembly-line style. To keep them clean in look as well they were often bleached or at least washed with lye soap.
The problem is, that the collar and cuffs take the brunt of the wear and the majority of the visible discoloration occurs on the collar. Obviously under the arms is the worst, but no one sees that! A clean, fresh collar could easily be re-sewn onto an older shirt body. However, by the mid-19th century the system of clothing availability had changed and people weren't going to their local Millinery to have small jobs like that done. Add in that the popular textile for shirts was now cotton instead of linen, which is more likely to hold onto the bacteria that causes the yellowing from sweat and harder to bleach out. The idea of separating the collar so that it can always be easily replaced in order to keep it the freshest part (and the most visible) of the shirt came about. In 1862 machinery was even invented specifically to laminate the collar fabric onto cardboard stock. Eventually in the mid 20th century that became more of the standard for dress shirts, the regular shirts being cheap enough to replace more often as well as often coming in multiple colors showing the discoloring less.