Show custom post type on post category page doesn’t work / breaks navigation

The reason the menu is disappearing is because pre_get_posts applies to all queries on the page, including menus, your code is interferring with the menu queries. The is_main_query method should make sure it only affect the query in the loop, which in most cases will be the query displaying the posts.

function test_add_cpt_to_archive_page( $query ) {
    if ( $query->is_main_query() && $query->is_archive() && ! is_admin() ) {
        $query->set( 'post_type', 'any' );
    }
    return $query;
}