Yes, both the Protoss and the Zerg attacked the Xel’Naga, but different factions of them.
Amon hated his own species and the Infinite Cycle and sought to end/corrupt it. After the Xel’Naga seeded the galaxy with life and went to slumber in Ulnaar to await the Races that represented Form and Essence to find them, Amon and his followers scoured the galaxy for the Race that represented Purity of Form.
It was Amon and his followers who uplifted the Protoss, and whom the primitive Protoss rebelled against and drove from Aiur, causing the Aeon of Strife.
Amon’s forces then searched for and found the Zerg, who represented Purity of Essence. While they were uplifting them, the Protoss ultimately re-established their primal psychic bond, which woke the Xel’Naga from their slumber.
The Xel’Naga then learned about Amon’s betrayal and went to war against him at Zerus. Amon unleased the Zerg and his own forces against the greater whole of the Xel’Naga, and Amon himself was “killed” and banished back into the Void during this conflict.
The Overmind, having killed/absorbed most of the Xel’Naga (not Amon’s forces), then set out to find the Protoss.
The lore does conflict on the Overmind’s purpose though. Sometimes, it states the Zerg were meant to wipe the Protoss out, other times it states that the Zerg were meant to infest the Protoss. Given that Infestation of the Protoss is not conventionally possible, I lean towards wiping out being the correct reason since, in-game, we never once see the Zerg even try to Infest them.