TL;DR
Rather than discrete items per quality, utilize the concepts of drain and durability similar to science packs, ammo, and spoilageWhat?
A normal iron ore is a 1:1 for a normal iron plate, but an 'uncommon' iron ore would last for more than 1 cycle, with that durability increasing like science packs do- Now, all iron ore stacks, it doesn't matter the quality
- If uncommon iron ore lasts 2x longer, have uncommon iron plates be forged at 2x drain, or to keep the design of filtering quality off to separate instances, have either a malus to non matching, or a bonus to matching, ingredients
- Now that the actual 'amount' of iron ore is abstracted into the 'spoilage' meter, with each individual item contributing its own amount of 'freshness' to the durability, an inserter grabbing the 'freshest first' of a stack of mixed normal, uncommon, and rare, should pull out 'rare' iron ore of the amount that corresponds to > rare threshold
- This is also similar to ammo usage and science packs being placed into 'fresh' stacks