In `WP_Query::get_queried_object()`, account for `pre_get_posts` by checking for `tag` when `tag_id` isn't present. Tags still need to be rolled up into `tax_query`. Add a unit test confirming expected query vars during and after `pre_get_posts`.

Props mattonomics for a patch.
See #27362.


Built from https://develop.svn.wordpress.org/trunk@27511


git-svn-id: http://core.svn.wordpress.org/trunk@27354 1a063a9b-81f0-0310-95a4-ce76da25c4cd