The mammary gland arises from the same stem tissues that form sweat glands. The human breast is mostly adipose tissue (fat) and is not functional in the production of milk. The actual glandular tissue and the network of ducts that bring the milk to the nipple are only a small portion of the tissue, except in actively lactating women. The breast gland absorbs nutrients, (chiefly glucose) from the blood, and use them as building blocks for lactose, and the many proteins found in milk. The milk of different mammals varies a great deal in content, including fats, and sugar levels and other elements. Seals, for instance have a milk which is nearly half fat, to allow the young seal to gain weight and insulation rapidly. Human milk is rather low in fat, comparatively, and very high in sugars, and proteins. The specific chemistry of the changes from blood elements to milk elements is exceptionally complex. The study of it is a very rapidly growing area of genomics from which we might gain easily reproducible vaccines, replacement hormones, and other complex chemicals produced by genetically altered mammals.)
Mammalian females are at some risk, nutritionally, when lactating. The priority of the body for needed materials is definitely weighted in favor of the offspring, and the mother’s bones, teeth, and other body parts will be stripped of needed elements to provide the essential nutrition in the milk. Survival of the mother is not a benefit in the cold equation of species survival. (In mammals, the father is most often an evolutionary liability after conception, so he doesn’t figure into this part of the equation.)
As you have noticed, some elements of the mother’s diet are transmitted directly into the milk. Dairy farmers are well aware of this as well, certain types of natural forage alter the taste of Cow’s milk and are carefully removed form the possible forage range of dairy animals. The value of such taste transmission might be that it helps young mammals recognize edible foods, early in their lives. The proteins transmitted in milk include many chemicals that assist the immune response of infant mammals. These are among the most beneficial of the characteristics that increase the survival of mammalian species.