Properly invalidate the cache for `wp_count_posts()` on insert, trash, or when transitioning `post_status` inside of `_transition_post_status()`. Introduces `_count_posts_cache_key()`. Adds unit tests.

Props mark8barnes, for bringing this to our attention in an initial patch.
Fixes #21879.


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


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