If you have a valid Thai National ID card and a valid Thai passport, you are a Thai citizen.
That is immaterial that you entered on a foreign passport.
The rule was recently changed by the Ministry of interior, that Thai citizens entering Thailand on a foreign passport will not be charged overstay fee /deportation or any punishment.
You don't have to exit Thailand or apply visa of any kind bcoz you're Thai.
Simply show your Thai passport, foreign passport and Thai National ID card upon exit