I believe you are suggesting that the starter motor was still getting power after the ignition was turned off, so the starter was still turning by electrical power.
If this is the case, it can’t be the starter that is at fault, but must be either the solenoid or the ignition switch that is at fault.
You need to identify whether the thin wire on the solenoid that connects back to the ignition switch has 12V on it when this happens.
If there is 12V on the thin wire when the ignition is not in the start position, then the ignition key is faulty. If there is not 12V on the thin wire, then the solenoid is faulty.
I have repaired a vehicle where the ignition key was sticking a little in the starter position, rather than springing fully back into position 2. One other symptom was that that things like the radio were not working when the key stuck in the start position.