Answering the narrow version, because the broad one does not have a single answer. The shortage clause is the answer to the second question and it is a subtraction rather than an addition. Both exemptions forbid compounding something that is essentially a copy of a commercially available approved product. A product FDA has listed as in shortage is not treated as commercially available, so listing removed the objection that otherwise blocked compounding. It never created a permission; it withdrew a prohibition, which is why it evaporated the moment the supply fact changed.
Happy to go further on any of that.