I would stress that rewriting it only to discover oh, so that's why they did it that way is one of the most disheartening exercises in our industry. Documentation is what clarifies the 'wtf' moments in reading code since even initially pristine architecture will become contaminated by edge cases over time.