How to replace the page url for the page slug in a menu link?

To be able to change the Link, you can hook into the nav_menu_link_attributes filter.

if ( ! function_exists( 'wpse_209457_nav_menu_link_attributes' ) ) {
    function wpse_209457_nav_menu_link_attributes( $atts, $item, $args ) {
        if ( 'primary-menu' == $args->theme_location ) {
            // Get the target posts slug
            $object_data = get_post( $item->object_id );
            $atts['href'] = '#'.$object_data->post_name;
            return $atts;
        }
    }
}
 add_filter( 'nav_menu_link_attributes', 'wpse_209457_nav_menu_link_attributes', 10, 3 );

To make specific items not appear in menus depending on the template they use would be better suited in a separate question, but I’m going to post the solution anyway. You need to use another hook here:

if ( ! function_exists( 'wpse_209457_wp_nav_menu_objects' ) ) {
    function wpse_209457_wp_nav_menu_objects( $sorted_menu_items, $args ) {
        foreach ( $sorted_menu_items as $key => $item ) {
            $template = get_post_meta( $item->object_id, '_wp_page_template', true );
            if ( "templates/ads.php" == $template ) {
                unset( $sorted_menu_items[$key] );
            }
        }
        return $sorted_menu_items;
    }
}
add_filter ( 'wp_nav_menu_objects', 'wpse_209457_wp_nav_menu_objects', 10, 2 );

I didn’t run this code, I hope it works for you.