$wpdb->prepare was called incorrectly when inserting multiple records

Well, you don’t need the second $wpdb->prepare() and just do $wpdb->query( $query );. The reason is because the $query does not contain any placeholders just as stated in the notice; only the items in $values contain the placeholders, but you already prepared them in the foreach. Additionally, be sure to run the query() only if the array $values is not empty.