Query: Fix category handling in pre_get_posts when pretty permalinks are in use (category_name query variable).

Merges [26864] [26874] [26875] to the 3.8 branch.

props wonderboymusic, SergeyBiryukov.
fixes #26627.

Built from https://develop.svn.wordpress.org/branches/3.8@26946


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