Can someone please explain the syntactic rules at work here?
Solution 1:
There's actually a bit of a problem here - the sentence, as provided, without context or a follow-up, is indeed ambiguous.
I'll illustrate first:
They all told me that I couldn't build my dream home by myself; but, I didn't.
This is how you resolved the sentence, with the meaning that the person built the home but had help - but this isn't the only way to interpret the sentence!
They all told me that I couldn't build my dream home by myself; but, I didn't.
Here the speaker actually didn't build the house at all. What did they do? Well, they could have grown the house, as in living in some sort of organic structure. They could have found the house of their dreams - perhaps abandoned or lost in some hidden or rarely visited area. They could have also just bought the dream home, and this is actually just a clever add for a real estate agent. Or they could have inherited or been given it, and perhaps this is an ad for one of those lost-property services or a lawyer/estate planning service.
And actually, this isn't the only way to interpret the sentence either!
They all told me that I couldn't build my dream home by myself; but, I didn't.
Here the speaker is referring to the fact that they themselves didn't build the dream home at all. This could even be combined with emphasis from the previous interpretation for another similar set of interpretations. Maybe their spouse did it, or their kid, or their grandparent - all are very possible introductions to a potentially interesting story.
So, what set of grammatical/syntactic rules are at work? In short: contextual re-interpretation, where ambiguity is resolved with additional information.
The purpose of the sentence is to provide a momentary pause, of confusion, not only because it violates a common template (They said...but I did, or They said...and so I didn't) but also because it is actually ambiguous. No rule leads us to only one interpretation, because it isn't the only valid one. It requires multiple re-readings to get a guess as to what the author might have meant, when no context is available.
Now, you could argue that proximity of "by myself" made the given interpretation more likely, and this is indeed a common enough sentence structure that it's a reasonable heuristic. You could also note that the specificity also made this part of the sentence stand out more, as we assume that all detail in a sentence is necessary for the meaning. For instance:
I told you I didn't want you driving at night; but you did it anyway.
Here we tend to assume that the problem was the "at night", and not the more general "driving" at all, due to both proximity to the objection and due to the specificity. If the speaker objected to driving generally, why did they specify at night? Well, this would also be somewhat ambiguous - because "at night" might have been intended as an intensifier!
Returning to the example sentence, let's look at it again:
They all told me that I couldn't build my dream home by myself; but, I didn't.
Now, why would "by myself" have been included if it wasn't important to the sentence? If they had said instead:
They all told me that I couldn't build my dream home; but, I didn't.
This is valid, but takes the natural emphasis away due to proximity and reduces our heuristic certainty. It could still be about going it alone, as they could follow with "my spouse and I built it together". But this seems like the less likely intent now.
However, as with my made-up example sentence, what if "by myself" was intended as an intensifier? The speaker was poor or physically disabled, so "they" said that not only could the speaker not build their own dream home, but they thought it was even more absurd that they'd be able to do it by themselves!
Ultimately, there is no syntactic rule that eliminates ambiguity from this sentence simply because there is still ambiguity. Multiple meaning and intentions are possible, and a reading agent can apply heuristic rules to find more or less statistically likely meanings - but no agent would be able to attain certainty.
Solution 2:
They all told me that I couldn't build my dream home by myself; but, (the thing is,) I didn't (try to do it, I had help).
He's saying they were wrong to assume I was trying to build it by myself.
EDIT:
The conjunction AND
, unlike BUT
, doesn't always provide contrast. Therefore, you might be right in saying that using and
is ambiguous here. It could mean:
They all told me that I couldn't build my dream home by myself; and (they were right), I didn't.
But I think that even here, the interpretation that the house wasn't built at all is far-fetched. If the speaker wanted to say that, they'd be more likely to say:
They all told me that I couldn't build my dream home by myself; and (they were right), I couldn't.