What is the derivative of a set or a string? Neural networks operate on numbers, and it's well-known what the derivative of numeric functions are, as well as what the derivative of matrix functions are.
What about functions that operate on maps or strings? Is there a derivative of the union/difference of a map, or the append/replace/delete/concat of a string? Does the chain rule still apply, or does another chain rule now exist?
What, if any, would be the study of the calculus of sets and strings? Would it be a calculus of sets and ordered sets?

With adequate care you might find a derivation for your operator which generalizes derivatives in an algebraic way, but functions over the elements of discrete structures such as strings and sets do not have derivatives.
Another approach is to introduce some functionals of metrics, as I briefly do below.
If you define a metric $d$ on some structures $\Omega$ and $\Omega^{\prime}$, you could consider the pairwise metric dilation
$$\operatorname{dil}_{\operatorname{pairwise}}(\eta) \triangleq \frac{d (\eta(u), \eta(v))}{d (u,v)}$$
or pairwise metric distortion
$$\operatorname{dis}_{\operatorname{pairwise}}(\eta) \triangleq |d (\eta(u), \eta(v)) - d (u,v)|$$
for a map $\eta:\Omega \mapsto \Omega^{\prime}$ and $u,v \in \Omega$.
Similar forms of above appear in Bronstein et al 2021, which take the supremum over possible choices of $u,v$ where $u \neq v$. They also have a invoke further generality of considering possibly-different metrics over $\Omega$ and $\Omega^{\prime}$.
