I made 2 mistakes in my comment.
try rather this code
function data_attribs_menu( $atts, $item, $args ) {
// check if ACF exists
if( class_exists('acf') ) {
$page_section = get_field( 'page_section', $item->object_id );
if( $args->theme_location == 'header-menu' ) {
if( $item->menu_item_parent == 0 ) {
$atts['data-color'] = $page_section;
} else {
$parentItem = get_post($item->menu_item_parent);
$parent_page_section = get_field( 'page_section', $parentItem->_menu_item_object_id);
$atts['data-color'] = $parent_page_section;
}
}
}
return $atts;
}
add_filter('nav_menu_link_attributes', 'data_attribs_menu', 10, 3);
this code only works when there is 2 levels of menu and according the example in the question, it’s what you need.