How is WP_Query parsed to determine which template to request?

The template loader determines which template to load for a given view, there’s a filter available to change this though, template_include as seen on the source page linked.

Moved from comment to answer.