Ensure that the post type object is the queried object when a post type has been registered with `has_archive => true`. Ensure it is not stomped when decorated with `tax_query`. Adds unit tests.

Props nacin.
Fixes #18614.



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