Of course it would work. A real world "attack" is more like a regressively patriarchal household where everyone "votes" at the dinner table. Yes, an 18 year old around that table could later make their way to a ballot station, but they'll run into their neighbors along the way, and if their swamp-creature of a father finds out, it won't go well for them.
I should be more precise. The voting system we have in Cook County accounts for the possibility that someone observed your vote, and that you might later want to rescind that vote. It does so imperfectly, as you note.
I will say that the system we have goes to some annoying lengths to try to maintain this particular kind of integrity. For instance, if you have vision problems and want your husband to help you read the ballot, we need triplicate signatures confirming that the assistance wasn't coercive. We had to stop people from helping family members, as if they were doing something wrong, which felt weird.
I've monitored elections in Ireland and the Netherlands which both have an interesting problem. They each use Proportional Representation and ranked voting. Voters filling in their ballots mark each candidate with a number indicating their preference.
There are routinely 10+ candidates in each constituency. That makes it easy to encode a highly-likely to be unique voter signature in the lower order numbers, which would make it possible to sell your vote.
To combat this, when the votes are unfurled from the ballot boxes in public, tallymen (independent checkers of the vote) are expected to record only the first preferences, and if you start marking any more, you can expect a conversation with the returning officer. They are keeping an eye out.
If you are a scrutinizer of potentially invalid ballots, which I've done a few times, you're also not allowed to bring or take any notes.