Writing had been invented three thousand years before Socrates
The passage criticizing the "invention of writing" is a quote from a legend where a Pharaoh passes negative judgement to a god, by the way, who had invented writing in the story.
Ironically, the dialogue in question, Phaedrus, is about the dangers of misreading text. It discusses writing political speeches not writing per se.