Considering evidence from ancient and prehistoric times of female warrior and hunter graves, queens who ruled alone, etc. Where did the modern stereotypical belief that for 'thousands of years' women's role was in the home' originate? And historically, when did women start taking on that protected role?
I can only answer for the “Western World” (stupid term: I mean Europe, the Nothern Americas), I’m afraid.
The idea of a house wife is rooted in very old theories about different characteristics of both sexes. Already in ancient Greece, Men and Women were believed to have polar characteristics that were perpetuated throughout history and customized to the preferences of each individual culture. Let’s give an example: Men are strong, women are weak. Man are rational, Women are emotional. You get the gist: Everything that is good, is associated with men, everything that is deemed bad or at leas inferior, with women. The best example for this was described by Lorraine Daston [Daston, L. (2008). Die Quantifizierung der weiblichen Intelligenz. In 'Aller Männerkultur zum Trotz': Frauen in Mathematik und Naturwissenschaften (pp. 81-96). Campus-Verlag.] Until the Renaissance, imagination aka creativity was considered to be a female characteristic, as it seemed closely linked to cunning and deceiving behavior. With a rising number of male poets and composers during the Renaissance, creativity was given a male, hence positive connotation. In consequence, creativity was henceforth considered to be a male quality.
Those characteristics were believed to be rooted in each sexes natural destiny: Women were reproductive in everything that they did, from childbirth to any kind of work, and increasingly, Men were meant to flourish in public spaces and do original work, whereas women should be restricted to the home, as they were predominantly identified by their marital and maternal status. (Karin Hausen (1976): Die Polarisierung der „Geschlechtscharaktere “. Reprint (2013) Dis/Kontinuitäten: Feministische Theorie, 162.]
Thus, most women were housewives for most of history. The interesting question however, as Deborah Simonton phrases it, is “when work at home became ‘not work’”. The idea, that a woman might have her own working identity, would have seemed ludicrous to most societies until very well into the 20th century. They were usually seen as assistants, be it on farms [ e.g. Whittle, J. (2005). Housewives and servants in rural England, 1440-1650: Evidence of women's work from probate documents. Transactions of the Royal Historical Society, 51-74.] or casual or temporal workers later in factories. During the 18th centuries, there are different motivations for a woman to work: you might, i.e. be a servant because you need to support your family or to save for a dowry, you might work in your family’s business (and this might even be a scientific endeavor [cf. Schiebinger, L. (1987). Maria Winkelmann at the Berlin Academy: a turning point for women in science. Isis, 78(2), 174-200.]) or you might do some industrial tasks. You would also be a housewife, whether you lived with your parents or with your husband (unless a widow, you wouldn’t live alone) insofar as you were responsible for keeping the house This meant taking care of the domestic animals (cattle, pigs, poultry), cleaning of the house and clothing, cooking, spinning , shopping, preparing food for storage, taking care of small children, heating,…. - if you were from the well-to-do-classes, this might have been your only job, and it may very well have consisted of delegating some or all of theses tasks to servants and oversee their work. In rural areas, women were also expected to help out with agricultural work, some came to farms as seasonal works, e.g during hay making. What was believed to be their natural abilities also led to them working in lot’s of handicraft work, spooling wool and making cloths.
Most of these jobs women also did during the 19. Century. In general, the rule applies: the further paid work moved away from home, the more it was associated with men. Obviously, unpaid work remained firmly in women’s hands: be it as part of the family on farms or in respect to housekeeping. But now this in fact became the foremost occupation for quite a few women, as men now were expected to earn a “family wage”. Between 1780 and 1840, being a housewife meant being the keeper of the private sphere, “family home became for a wife what business became for her husband; her job was to maintain and direct a well-run household, just as her ran firm.” The word “firm” already alludes to the social strata to whom this quotation holds: Those, who had enough money, e.g. because the profited from the Industrial revolution, not only as directors, but also as engineers. It also included those, who held lucrative official positions, doctors, merchants, certain shop owners, increasingly teachers (at least those, employed in secondary and higher education) and of course all those that came from money. During the 19th century being a housewife was a sign that your husband made enough money, that you didn’t have to either help with the family work (think farms), or earn an additional to support your family. In the presumably most perfect case your husband would earn enough (or your family had enough money) that you would only delegate work to servants and engage in the new fad of the time: decorating the home. Work as a maid, in factories, as teacher or a help on farm was only done by unmarried women or those who had to support their families. [Simonton, D.: Women Workers. Working women. The Routledge History of Women in Europe Since 1700, Simonton, D. (ed.), pp. 134 -176 , quotations on pages 134 & 149.]
Tl, dr: During the 19. Century being a housewife became a prestigious status, indicating, that your family had enough money/your husband earned enough that it wasn’t needed that you provided additional work or income.
The difficulty in answering this question is that there being women in the ancient Mediterranean/Near East who performed leadership roles (I am not aware of definitive evidence of women fighting as warriors) doesn't mean that women in general weren't expected to restrict themselves to the home. Here are a couple of answers I wrote previously that deal with the situation of women in this period:
For the overarching question of how women could be oppressed as a class while individual women were allowed to surpass the average expectations, I have a few others from later periods:
Did ruling Queens in historical Europe face gender discrimination?
Were women monarchs as respected as their male counterparts?
You might want to consider asking this over at r/AskAnthropology, too.