The first thing that struck me about your question was that Thoreau was a Transcendentalist and Melville an avid ANTI-Transcendentalist; thus, their views are usually totally different (especially in regards to nature). For example, Thoreau thought nature so good that it held the divine while Melville thought nature so evil that it could only be represented by brute instinct, as in the case of his Moby Dick. Noting these differences, it makes your question VERY interesting to me! Therefore, first let's look at what marriage WAS in the 19th century. Then we can explore the critiques by Thoreau and Melville and how the former says a lot by saying nothing while the later says a lot by SAYING a lot.
Put simply, the norm of 19th century marriage was family and children with the success of the husband outside the home and the success of the wife inside the home. This being said, though, it is the century where things began to change. Motherhood was still a crowning jewel; however, women were having less children because of both new opportunities and less need of the actual workers on the farm. Industrialization, of course, had a lot to do with the changes. Young women now often left the home, sometimes to become some of the famous "Lowell Factory Girls" in Massachusetts, earning income to send BACK to their families. Further, legal status of women was finalized during this century as well as a more common possibility of divorce.
Now to take the plethora of quotations from Walden concerning marriage. ... Ha! They don't exist! Although Thoreau assumed most men would marry, he decides to talk about the simplicity of life WITHOUT A WIFE. Both eNotes says, "Thoreau never expected his readers to follow his example and live alone in a one-room hut. Such a life would make marriage difficult, if not impossible (indeed, Thoreau remained a bachelor)." And eNotes educators say, "One thing Thoreau does not talk about is marriage. It is really fairly easy for a single man to live cheaply, even today. But most people want to get married and end up doing so, which usually results in having children. We don't know how Thoreau could have coped with family life." Thus, Thoreau values three things: "Simplicity! Simplicity! Simplicity!"
I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.
Thus, anything we say about Thoreau and marriage must be an opinion. So, in my professional opinion, Thoreau didn't prefer marriage. How do I know this? He remained a bachelor his entire life! I would also imply that marriage in the nineteenth century (echoed by the sentiments in the first body paragraphs) was not able to achieve the kind of simplicity that Thoreau deemed important.
On the other hand, there is Melville's Pierre that doesn't cease to imply the issues with nineteenth century marriage! The machinations of the plot is enough to make one's head explode. The wealthy Pierre wants to marry one woman (Lucy), but he doesn't. Pierre SAYS he marries another woman (Isabelle), but he doesn't because Isabelle is Pierre's half-sister and was born illegitimate. Still, three end up living together with ANOTHER girl servant (who was also born illegitimate). The mere fact that Isabelle is Pierre's sister kills Lucy immediately. As a result, and in homage to Romeo and Juliet, Pierre poisons himself as a result and Isabelle drinks the rest. Note that Pierre's alternate title is The Ambiguities! The novel itself admits that, "a gentle sister is the second best gift to a man." In all seriousness, though, eNotes hits the nail on the head about marriage in Pierre:
The idea that two people who have known each other since childhood and are as close as brother and sister are the best candidates for marriage is another plot device familiar in nineteenth century novels, and, like Pierre’s relationship with Isabel, again raises the issue of incest. ... Here the satire of the first part of the novel bears fruit; Melville may be suggesting that people nurtured in sentimental fantasies are so ill-equipped to deal with reality that when they must do so, the result is yet another sentimental fantasy.
In other words, Melville (in true anti-Transcendentalist form) makes marriage a satire here. Anyone who are nurtured in sentimentality in regards to marriage are completely unable to deal with reality in marriage. As is the case with Pierre and Lucy (and Isabelle). Further, there is quote after quote of anti-Transcendentalist pessimism:
I say, I can not identify that thing which is called happiness, that thing whose token is a laugh, or a smile, or a silent serenity on the lip. I may have been happy, but it is not in my conscious memory now. Nor do I feel a longing for it, as though I had never had it.
For in tremendous extremities human souls are like drowning men; well enough they know they are in peril; well enough they know the causes of that peril;--nevertheless, the sea is the sea, and these drowning men do drown.
In conclusion, honestly, I can't help laughing. All Pierre DOES is go on and on about the issues and machinations of marriage while Walden never even MENTIONS it! I couldn't help laughing in that, in an ironic way, both of them have a similar say about marriage in 19th century America: the best way to have a simple life is not to deal in marriage AT ALL.