A core contributor had mercy with me – and an answer:
$post_type = get_post_type('tires')
is not the correct method to get the post type in a reliable way.
Instead, you need to use is_post_type_archive(‘tires’)
The correct function looks like this:
// Template Logic
function rg_wp_tires_template_logic($original_template) {
if(is_post_type_archive('tires') || (is_search() && $_GET['post_type'] === 'tires')) {
if(file_exists(get_template_directory_uri() . '/archive-tires.php')) {
return get_template_directory_uri() . '/archive-tires.php';
} else {
return plugin_dir_path(__FILE__) . 'templates/archive-tires.php';
}
} elseif(is_singular('tires')) {
if(file_exists(get_template_directory_uri() . '/single-tires.php')) {
return get_template_directory_uri() . '/single-tires.php';
} else {
return plugin_dir_path(__FILE__) . 'templates/single-tires.php';
}
}
return $original_template;
}
add_action('template_include', 'rg_wp_tires_template_logic');
I really hope this helps someone in the future.