There could be more than one scenario. One scenario, I am sure is the headphone jack tension/mechanical system. When I replaced the new headset jack, the mic perfectly worked fine. After replacing I was connecting car audio 3rd party 3.5 mm pin to the iPhone jack. When inserted first couple days, it was tight, after a week it became loose, I found that there is a v shaped plates at the bottom of the jack, which makes a contact when an headset pin is inserted. Over the days, those plate contact becomes permanent irrespective of headset pin presence.
My phone started repeating the same problem.
Then again, I opened device, removed the jack, then at the bottom inserted a sharp pin and pushed away the plates, which were making contact with inner circle wall.
Then remounted the same jack.
Iphone mic started working fine.
Now I stopped inserting car audio pin to the device, instead using cradle to play music.
Apple support bluffed about OS soft reset as a solution, those all useless. Majority of the devices would be having jack issue, which I guess is design fault of pin insert and plate spring system which changes the state of the jack connected.
Hope it helps.