WP::is_main_query() Not Working

Wrong hook, because what gets passed to wp is the

Current WordPress environment instance

not

The WP_Query instance

like it is e.g. passed to loop_start.

You could actually just do your check inside the function callback you hook to loop_start.

Edit/note:

You could just have done global $wp_query; inside the wp hook, it is actually the first one where access to $wp_query is possible, to have access to it – not that I recommend doing it though. A better place – or at least the one I probably would go for – to hook into is the pre_get_posts action, which does get passed $query – the WP_Query object – by reference.