Modify the category post counting function

When registering a custom taxonomy, register_taxonomy() accepts an update_count_callback argument.

This callback function will be called when the count is updated. The default callback is _update_post_term_count() for taxonomies attached to post types, which confirms that the objects are published before counting them.

_update_generic_term_count() is the default for taxonomies attached to other object types, such as users.

You can check out the code for both functions to see how you can create your own callback to make the count more accurate.