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.



git-svn-id: https://develop.svn.wordpress.org/trunk@27511 602fd350-edb4-49c9-b593-d223f7449a82