Cooking used to be considered women's work, and it was a standard part of a girl's education. Not in all families; my mother said "Watch and learn" but wouldn't let me try hands-on, for fear I'd make a mess in the kitchen. At least that's what she said. I think, though, most mothers taught daughters something about cooking (and cleaning up), maybe also sons. My junior high school required a year of cooking class and a year of sewing class for girls. Boys took shop. In the U.S., that would be illegal sex discrimination now.
Back when fewer men cooked, how did those who didn't live with a woman (mother, wife, sister, housekeeper) take care of themselves? Some were in the military, some bought all their meals, and boarding houses were common for men working in cities.