In the case of 12 the objection is that the author is unfairly tricking (intentionally or not) the reader into making a mistake, which is unnecessarily hostile.
That's why one of the suggested fixes is simply to place a warning that the following is not to be read as reliable gospel.
Exactly. It doesn't even have to necessarily say "this is wrong" ... just something that causes you to engage with the example as potentially unreliable or not the best solution.
"The traditional way to solve this problem ..."
"Other tutorials suggest something like the following ..."
It's just sadistic to give an example that doesn't work and then I waste time looking for a syntax error or typo that doesn't exist.
That's why one of the suggested fixes is simply to place a warning that the following is not to be read as reliable gospel.