Not sure how your delivery was, but maybe the best way is, “If I were doing it that way, here’s how I’d go about it. However, I might consider this other way and here’s why.”
Another viewpoint I've seen when sharing this story is that the interviewer wants me to start with the "bad" implementation first, then we move on to the "proper" one, but what's the point if I actually have pointed out the flaws beforehand?