I’m feel I’m getting closer to the issue. I think the is_404() fix is the best one (and the other defensive programming is also useful that you said you have put in for the next release). I’m not convinced that this is a bug outside your plugin. I’m starting to wonder if in some rarer instances your filter callback is legitimately called with $wp_query->post being not set. In which case your callback should handle that case (by returning $title).
See the first answer to my question on StackOverflow: https://stackoverflow.com/questions/33283211/why-is-wp-query-post-unset-during-404
It’s not that $wp_query->post is unset during a 404…but rather that it’s never set at all. In fact, $wp_query->post is unset for all new instances of WP_Query, when it is initialized.