Using echo wont accurately show when code is firing. You should use die instead.
basically the page is being buffered as it is being created from the template and other plugins. This is done so that paths can be adjusted and such, only once the entire page is created is anything written to the screen, the order of the echoes wont really .
The template code is executed where the theme is instantiated, so moving the theme code block will ensure that the header code from the template is executed before the any code that comes after it.