Global $post value outside the loop

Yes, this is how it is supposed to work. The global $post variable is set quite early in the page load, at the wp hook. As you can see from the hook order, this is before the loop starts.

Basically the $post object exists independent from its actual content in the database, which you retrieve during the loop. It’s specifically meant to be accessible all the time during page generation.

tech