Iain was trying to be non-judgmental in his answer, so I won't be...
The answer to the question you asked in the first comment is: no, edits that improve answers aren't necessarily rejected because they aren't required, but your edit was rejected because it didn't improve the answer. It was a bad edit and deserved to be rejected.
- It didn't make an overall improvement to the answer. I thought one part of the answer was somewhat clearer after your edit, but most of it was not improved.
- It made the answer harder to read. The large headings were jarring and didn't add improve the readability of the answer.
As Iain has said, the other 4 canned reject reasons don't really cover this situation, but typing a custom reason takes a significant amount of time, so picking "invalid edit" is a good compromise for a reviewer.