wp_nav_menu: Is there a way to modify the output of that got a submenu?

You should be able to use nav_menu_link_attributes to add attributes to links output by wp_nav_menu that have child/submenu links.

wp_nav_menu conditionally assigns classes to links it outputs. You need to target links with the class .menu-item-has-children

You can add the attributes you want with the following filter/function:

add_filter( 'nav_menu_link_attributes', 'wpse270596_add_navlink_atts', 10, 3 );
function wpse270596_add_navlink_atts( $atts, $item, $args ) {
  if (in_array('menu-item-has-children', $item->classes)) {
    $atts['data-toggle'] = 'dropdown';
    $atts['aria-haspopup'] = 'true';
    $atts['aria-expanded'] = 'true';
  }
return $atts;
}