add dynamic ID for wp_nav_menu after and before

Try this:

function custom_walker_nav_menu_start_el($item_output, $item, $depth, $args){
  $output="<div class="buttons-".$item->ID.'" title="some_title">';
  $output .= $item_output;
  $output .= '</div>';
  return $output;
}
add_filter( 'walker_nav_menu_start_el', 'custom_walker_nav_menu_start_el' , 10, 4 );

This uses walker_nav_menu_start_el filter to add custom content before and after the link item. ID is appended to buttons-. If you need this customization for only specific menu then you can check $args as your requirement.

error code: 523