How do I add attributes to an entity reference field?
The best and standard way to do this is with paragraphs.

Enable the paragraphs module, then add a paragraph type called ingredient with the two fields, an entity reference field and a field for the quantity.

if you want an ingredient to be reusable, keep in mind that paragraphs are not reusable.  If you want to reuse an ingredient, say "1 cup flour", then you could use an entity reference field to another reusable entity type, such as media or taxonomy, or another node type.