Now it makes a little more sense....
Did you try to escalate the issue at an higher level ? Your iPhone was defective since the beginning, so Apple should replace it even if out of warranty. Especially because it's a refurbished unit THEY gave you...
That's the whole point of a warranty -- to protect against defects there since the beginning. And Apple confirmed it was NOT a refurbished unit. They told me that all warranty replacement phones are newly manufactured phones expressly for warranty replacements under Apple Care. So there was nowhere to escalate the problem to, other than to make Apple change their policies about warranty coverage.
I'm buying an SE, so it's sort of moot. I don't sell my phones anyway and keep them as backup phones, so as inconvenient as these problems with my 5s are, there's not much point in making more of an issue out of it than I already have.
However, based on user threads I read trying to resolve this problem, I'm not the only one who experienced these issues. In fact the OP may be likewise suffering a related problem (though he won't know until he resets the phone). There might be grounds for a class action lawsuit, but even that's sort of pointless.
The only lesson learned here is always get Apple Care +, or purchase using a major credit card to extend the warranty, or both. Considering that every single iPhone I've ever had has been replaced at least once under warranty, it would seem to be essential.