WP Query for variable taxonomies

tax_query requires an array of arrays, and $the_taxes is an array of arrays, you’ve already got 99% of your answer.

foreach ($taxes as $tax) {
    $the_taxes[] = array (  
        'taxonomy' => $tax,
        'field'    => 'term_id',
        'terms'    => $terms,
    );
}

$the_taxes['relation'] = 'OR';

$args = array(
    'post_type' => 'post',
    'tax_query' => $the_taxes,
);