I believe the correct solution here is to just update the $capability component of the admin_menu items rather than just remove them from the menu structure.
Try this:
/** Set 'administrator' cap for particular menu items **/
function update_admin_menu() {
global $menu, $submenu;
$menu[10][1] = 'administrator'; // Media
foreach( $submenu['upload.php'] as &$item ) {
$item[1] = 'administrator';
}
$menu[75][1] = 'administrator'; // Tools
foreach( $submenu['tools.php'] as &$item ) {
$item[1] = 'administrator';
}
}
add_action( 'admin_menu', 'update_admin_menu', 1000 );
Please note that checking against user levels is deprecated, but it works in this situation and is essentially the same as it would be if you created a new cap (which administrators would automatically have access to,) and assigning that capability to these menu items instead.