This late in the process you should be able to rely on context set up, even outside of loop.
On top of my head something like this should work:
$categories = wp_get_post_categories( get_the_ID(), [ 'fields' => 'names' ] );
This late in the process you should be able to rely on context set up, even outside of loop.
On top of my head something like this should work:
$categories = wp_get_post_categories( get_the_ID(), [ 'fields' => 'names' ] );