If you want to get the '#attributes' value out of $form, then do: $form['#attributes'].
If you want to get the 'ingredients' value out of $form['#attributes'], then do: $form['#attributes']['ingredients']
What is generating this large $form array?
Btw, this line looks suspect too:
'#default_value' => '#required' => $ingredient->unit_id
If you want to set both the '#default_value' and '#required' indices to $ingredient->unit_id, then you need to put them on separate lines:
'#default_value' => $ingredient->unit_id,
'#required' => $ingredient->unit_id,
|