Taxonomy archive page WP_Query does not return get_the_permalink() or get_permalink() value

Problem was that I had broken the permalink structure for the CPT with the following filter:

    function classes_permalink_structure($post_link, $post, $permalink, $sample)
        {

        if (strpos($permalink, '%classes_class_type%') === FALSE) return $permalink;

                    // Get post
                    $post = get_post($post_id);
                    if (!$post) return $permalink;

                    // Get taxonomy terms
                    $terms = wp_get_object_terms($post->ID, 'classes_class_type');   
                    if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
                    else $taxonomy_slug = 'all-class-types';

            return str_replace('%classes_class_type%', $taxonomy_slug, $permalink);

        }
    add_filter('post_type_link', 'classes_permalink_structure', 10, 4);

My understanding of permalink restructuring, largely based on this tutorial is still quite vague.

As far as I can tell, the following code:

    $class_type_structure="/classes/%classes_class_type%";
    $wp_rewrite->add_rewrite_tag("%classes_class_type%", '([^/]+)', "classes_class_type=");
    $wp_rewrite->add_permastruct('classes_class_type', $class_type_structure, false);

registered in the init filter (along with register_taxonomy in this case) seems to be all that’s necessary:

function create_class_type_taxonomies() {
    if (!taxonomy_exists('classes_class_type')) {
        register_taxonomy(
            'classes_class_type',
            'classes',
            array(
                    'labels' => array(
                            'name' => 'Class Type'
                    ),
                    'show_ui' => true,
                    'show_tagcloud' => false,
                    'hierarchical' => false,
                    'publicly_queryable' => true,
                    'query_var' => true,
                    'rewrite' => true
                    )
                );
            }
        global $wp_rewrite;

        $class_type_structure="/class-type/%classes_class_type%";
        $wp_rewrite->add_rewrite_tag("%classes_class_type%", '([^/]+)', "classes_class_type=");
        $wp_rewrite->add_permastruct('classes_class_type', $class_type_structure, false);
        }

add_action( 'init', 'create_class_type_taxonomies', 0 );