In visual/UI design, a stylistic convention whereby objects and content that belong and/or act together are visually grouped together.
Placing the edit button above the section header violates the principle of visual containment. It' s not visually obvious WHAT is being edited.