How to enable a custom post type to custom user role in WordPress

I don’t think the plugin adds the capabilities you are using in add_cap while registering the post type.

You can modify the registered post type by adding code to themes functions.php file. You can do something like this.

/**
 * Overwrite args of custom post type registered by plugin
 */
add_filter( 'register_post_type_args', 'change_capabilities_of_course_document' , 10, 2 );

function change_capabilities_of_course_document( $args, $post_type ){

 // Do not filter any other post type
 if ( 'course_document' !== $post_type ) {

     // Give other post_types their original arguments
     return $args;

 }

 // Change the capabilities of the "course_document" post_type
 $args['capabilities'] = array(
            'edit_post' => 'edit_course_document',
            'edit_posts' => 'edit_course_documents',
            'edit_others_posts' => 'edit_other_course_documents',
            'publish_posts' => 'publish_course_documents',
            'read_post' => 'read_course_document',
            'read_private_posts' => 'read_private_course_documents',
            'delete_post' => 'delete_course_document'
        );

  // Give the course_document post type it's arguments
  return $args;

}

Then you can do

/**
add teachers capability
*/
add_action('admin_init','rpt_add_role_caps',999);

function rpt_add_role_caps() {

    $role = get_role('teacher');               
    $role->add_cap( 'read_course_document');
    $role->add_cap( 'edit_course_document' );
    $role->add_cap( 'edit_course_documents' );
    $role->add_cap( 'edit_other_course_documents' );
    $role->add_cap( 'edit_published_course_documents' );
    $role->add_cap( 'publish_course_documents' );
    $role->add_cap( 'read_private_course_documents' );
    $role->add_cap( 'delete_course_document' );


}

You don’t need to add capability to administrator and editor because the capability_type is post by default while registering Custom Post Type via this plugin. You can change it, if you prefer to have custom capability_type based on other post type.

Note: Make sure Show in Menu is set to true. It is true by default in this plugin.