Why does Sophy wonder if she ''had done wisely in shaping life'' in "The Son's Veto" by Thomas Hardy?
That question of grammar bore upon her history, and she fell into reverie, of a somewhat sad kind to all appearance. It might have been assumed that she was wondering if she had done wisely in shaping her life as she had shaped it, to bring out such a result as this.
You'll note from the quotation above that Sophy does not in fact think, wonder, or say this quote asked about herself. You'll note that it is the third-person narrator who says that, by all appearances to an observer, it looked as though this were the thought that might have been going through her mind: "to all appearance. It might have been assumed that she was wondering ...." Having clarified your question and your reading of Hardy's syntax and text, let's ask why it matters to whom the idea is attributable and if the narrator is trustworthy, then we can analyse why Sophy might be supposed to be thinking any such thing.
If the narrator says this as a external observation about Sophy, that leaves the mystery of Sophy's characterization free to build deeper into the story: we don't have Sophy's innermost thoughts exposed immediately. This eliminates the immediate diagnosis of psychological depression and remorse so we are free to construct Sophy's character from the other evidence that comes our way. If Sophy had actually wondered this herself, that would have take us through a direct route into her inner characterization; we wouldn't have the benefit of the narrator's judgemental and discerning eye to guide us through evaluating the vicar's and Randolph's claims on and assessment of Sophy.
The paramount question then is: Is the narrator trustworthy? Hardy sets the narrator up as being perfectly trustworthy because he corroborates his observations through the observations and reactions of the people at the open air concert and by being impartial in that he reports only what the characters say and do while including his stated suppositions, like the quote in question, of what might lie behind their actions and words (to illustrate, we never know what Sophy and Sam quarrel about and break off their engagement over).
The narrator supposes Sophy might be wondering about the choices she had made because her beloved son, whose name marks him as her "protector," turns on her in public and upbraids her for her grammar, which is appropriate in her home country dialect but uneducated amid London's upper classes. The narrator supposes Sophy might be wondering this because it is highly unpleasant to be corrected by one's own son and because such actions show her son's disdain of her when, of course, Sophy wants him to love her and be proud of her just as she loves him and is proud of him. The narrator further supposes Sophy might be wondering this because, in such a reverie, one's thoughts turn to past lost opportunities (which is a neat foreshadowing of Sam's entanglement with her life).