Bach did not invent equal temperament. He probably had thought of it at some time, but his writings make it clear that he would be against such a concept. He was in favor of a 12-tone temperament, but it wasn't equal. It's not clear, but I generally doubt he invented it, only that he heard it at some point and favored it.
Thank you for the clarification. Music is weird. My understanding was the well-tempered clavichord was one of the oldest deviations (that was written) from the concept of just intonation: you learn something everyday.
"the well-tempered clavichord" is early in the transition to well temperaments, previously organs (and harpsichords) couldn't play in all keys which was limiting. It may well be the oldest thing we have written (I don't know) however there were a lot of different experiments.
You can tell that this wasn't equally tempered because composers talked about the "color" of each key, a concept that doesn't make sense unless the keys sound different.