TLDR: The premise of the question is only true for male-oriented works.
The main bulk of the question (the reason for women in anime being portrayed mainly as housewives) has been answered by Fumikage Tokoyami quite comprehensively, so this is more of a frame challenge to the question than a straight answer.
There is significant gap between the portrayal of women in anime/manga between male- and female- oriented works. In male-oriented works, female characters do indeed frequently end up as full-time housewives or at least dream of becoming one – however, this really is not the case in shoujo (works targeting girls) or josei (works targeting adult women).
Even in romantic comedies, girls dream to be a good housewife after
they marry their boyfriends. Very few are shown to be working, and
even if they are shown, they are portrayed as poor mothers, e.g.
Nisekoi.
Note that Nisekoi is shounen (and a harem comedy, the most male-wish-fulfillment style of romantic comedy at that). In shoujo, if the future beyond school/university is mentioned at all, female characters will very frequently (if not almost always) have concrete career goals, and will be shown achieving them if the story does progress that far (e.g. Yukino becoming a plastic surgeon in Karekano, Shizuku passing the bar exam in Tonari no Kaibutsu-kun, Koizumi Lisa wanting to become a stylist in Lovely Complex)
In Josei (targeting adult women), this is even more apparent – very rarely will the main female lead not have a career (see Nodame Cantabile, any of Nishi Keiko’s works, Natsuyuki Rendezvous and so on) In fact, the stereotypical Josei romance plot could be summed up as: Careerwoman tired of her job and life in general meets handsome man romantically interested in her – hijinks ensue.
The example of Hinata Hyuga (as given by Fumikage Tokoyami in their answer before their edit) and the ending of Naruto in general is interesting, because the major female characters, with veritable abilities and merits, end up as domestic supporters for the male characters, rather than holding significant positions of their own. This kind of “sudden housewife” shift (or as the OP put it, "become submissive towards the end of the story”, is almost exclusive to shounen or seinen.
In shoujo or josei, characters who appear mainly as housewives or in an otherwise domestic role will generally start out enjoying or showing interest in such roles (e.g. Love So Life – the female lead of which does dream of becoming a nursery teacher), at least disillusionment or a lack of interest in her career (e,g, side characters in Nishi Keiko’s works, Nigeru wa haji daga, yaku ni tatsu – the female lead here does end up working again, IIRC) or as a mother of a main character.
In short, the idea that most women in anime are housewives (or aim to be housewives) is for the most part a phenomenon limited to male-oriented works. The situation for female characters in female-oriented works is much more complex.
Sidenote: That said, many shoujo and josei works DO end up in marriage – While there certainly are exceptions like & (that’s the title), it can be deduced that marriage is still considered important, as Fumikage Tokoyami has stated.