if it came down to the fact that it was a proven hardware defect and could not be fixed via software, apple would have no choice but to recall the product. this isn't the same as a toy recall for instance where the product is dangerous to a consumer. they would have to accept all iphones bought before a certain date/batch and switch them for a new, tested model.
if they do not take this action under the worst case scenario, there would be major major problems for the company. they have a share price and image to worry about. there is no way the higher ups at apple would ever let this happen. it would be done very swiftly.