Probably everyone of us has seen set-theoretic encodings of mathematical objects which we wouldn't naturally consider to be sets. May it be the "definition" of a function from $A$ to $B$ as a relation $f\subseteq A\times B$ with the property $$\text{for every single $a\in A$ one can find exactly one $b\in B$ with $(a, b)\in f$ }$$ or the construction of natural numbers due to von Neumann in which we consider $0$ to be the empty set, $1$ to be the set $\{0\}$, $2$ to be the set $\{0, 1\}$, and so on.
But why do we bother about set-theoretic encodings? When did mathematicians historically felt that we need to code non-set entities as sets? What's the purpose of doing so?