While Book of Exodus may be a major bringer of "eye for an eye" to western culture, it is certainly not the origin of the principle. The Hammurabi code predates the events described in the book of Exodus (and thus the book of Exodus) by many centuries, and does encode "Eye for an eye" as a literal prescription (If an citizen should blind the eye of another citizen, they shall blind his eye.)
So it was also a prescription - but yes, as you say, it is also a limitation for retaliation, assigning an equivalent punishment to limit escalation of vengeance.
"Eye for an eye" comes from the Book of Exodus, and it was meant not as a prescription, but as a limitation:
> The intent behind the principle was to restrict compensation to the value of the loss.[1]
* https://en.wikipedia.org/wiki/Eye_for_an_eye