It's a little humbling when the solution turns out to be different enough from the plans to have to rewrite the doc.
As a seasoned developer, I would agree. It really doesn't seem that OP is a seasoned developer, though. So, when the code that actually works turns out to be completely different from the original plan, that's not surprising. Everyone goes through that. That's how you learn to plan better.