That is such a complicated question to answer as it would require a fix of the base game itself, and one I've answered many times before, but ... You asked! :D
My ideal quality idea is as follows:
Miners accept quality modules and output quality as it currently exists, this I didn't have much of an issue with.
ALL buildings can accept quality items regardless of the item being produced.
Example: Assembler is producing object A. It requires 20 items to make (10 steel, 5 green circuit, etc). If you're requesting to produce Rare(blue) quality, and you insert all blue, you get blue 100%... If you insert all standard objects, you get a 0.1% chance of getting a blue object, and a 1% of getting a green object. Each % quality adds to the outcome result, so if you insert 20 green quality objects, you have a 1% chance of getting a blue object.
(The numbers I provide are arbitrary, I'm sure someone who's much better at the maths could suggest a better calculation)
All items produced are of the quality requested (or lesser) never greater. If you ask to make a standard mech armor and use all legendary items, you sacrifice all legendary materials to get a standard result.
That takes care of my general overall idea... As far as upgrading materials to get a better result, I would introduce a precision manufacturer that can take x# of items, take the best materials from each, remove impurities, and pump out a new product as a result, but of higher quality, with a random (and guaranteed) chance to get a higher items, quality modules increase the chances of this outcome (I understand mods like this exist, but they're all very fixed and almost feel too cheaty, which is why I was interested in your mod as it requires actual effort and recipes to upgrade items).
As far as YOUR mod is concerned, I guess I assumed it worked sort of as follows
standard mech armor + post processing unit = processed mech armor
processed mech armor + housing = reinforced mech armor
This would be like upgrading a yellow inserter to make a blue, to make a green, etc. Each one uses the one before it, but with new items each time. Of course that isn't a quality upgrade but an item upgrade.
I've always hated the way quality worked in this game, it's by far my least favorite thing about Factorio.