Given a set $X$. Let $S\subseteq X$ and consider $(X,S)$ as a very simple mathematical structure, lets call it a spotted set in analogy with pointed sets. Given two spotted sets, then a morphism $\alpha :(X,S)\longrightarrow(X^\prime,S^\prime)$ reasonably is a function $\alpha :X\longrightarrow X^\prime$ such that $x\in S\Rightarrow \alpha(x)\in S^\prime$.
In topology there is a spotted set $\tau\subseteq \mathcal{P}(X)$. Then morphisms are functions $\mathcal{P}(X)\overset{\alpha}{\longrightarrow}\mathcal{P}(X^\prime)$ such that $\mathcal{O}\in\tau \Rightarrow \alpha(\mathcal{O})\in \tau^\prime$. If there is a function $f:X^\prime\longrightarrow X$ such that $\alpha = \mathcal{Q}(f)$, where $\mathcal{Q}$ is the contra-variant power set functor, this correspond to Top and $f$ is continuous with respect to the topologies.
There are corresponding coincidences for several other structures, where the formulas of the morphisms can be derived, and my question is if there is an explanation to this correspondence?
Examples:
Group-like structures as magmas and categories are characterized by relations $R\subseteq (X\times X)\times X$ and can obviously be expressed as spotted sets. Morphisms are functions $\alpha:(X\times X)\times X\longrightarrow(X^\prime\times X^\prime)\times X^\prime$ such that $((x,y),z)\in R \Rightarrow \alpha((x,y),z)\in R^\prime$. Functions $\alpha_1,\alpha_2,\alpha_3:X\longrightarrow X^\prime$ exists such that $\alpha((x,y),z)=((\alpha_1(x),\alpha_2(y)),\alpha_3(z))$ and if $\alpha$ is such that $\alpha_1=\alpha_2=\alpha_3$, then $\alpha_1$ correspond to group homomorphisms etc.
Action-like structures $R\subseteq (A\times X)\times X$. Here morphisms are functions $(A\times X)\times X\overset{\alpha}{\longrightarrow}(A\times X^\prime)\times X^\prime$ such that $((a,x),y)\in R \Rightarrow \alpha((a,x),y)\in R^\prime$. It exists functions $\alpha_0,\alpha_1,\alpha_2$ such that $\alpha((a,x),y)=((\alpha_0(a),\alpha_1(x)),\alpha_2(y))$. If $\alpha_0=1_A$ and $\alpha_1=\alpha_2$ this correspond to morphisms of actions.
Uniform spaces with a set of entourages $\phi\subseteq\mathcal{P}(X\times X)$. Morphisms are functions $\mathcal{P}(X\times X)\overset{\alpha}{\longrightarrow}\mathcal{P}(X^\prime\times X^\prime)$ such that $\mathcal{U}\in\phi \Rightarrow \alpha(\mathcal{U})\in \phi^\prime$. The condition on the morphisms of spotted sets to correspond to a uniformly continuous function is similar as above.
Multigraphs. Function $\varepsilon \subseteq E\times V^2$.
Undirected graphs. $E\subseteq\mathcal{P}(X)$, $e\in E\Rightarrow \alpha(e)\in E^\prime$, where $\alpha$ is a function $\mathcal{P}(X)\rightarrow\mathcal{P}(X^\prime)$.
It might be a good idea to point out that the formula for a morphism only depend on some outer structures. For example in magmas all formulas are the same and doesn't depend of "inner" conditions as associativity or inverses, with the exception of certain selected elements as a unit element.
If $\tau\subseteq \mathcal{P}(X)$ isn't a topology but is an other structure, the same formula would still be valid: $\alpha$ would be a morphism if there was a funcion $f:X^\prime\to X$ such that $\alpha = \mathcal{Q}(f)$ and $\mathcal{O}\in\tau\implies f^{-1}(\mathcal{O})\in \tau^\prime$.
There is an obvious an analogy with the Hom functor where magmas and universal algebras correspond to the covariant case, morphisms $\mathbb N\to X$, and the topological case correspond to the contravariant case with morphisms $X\to\mathbb N $.
I see nothing "magical". A topological space is a set with certain additional properties. The category of topological spaces respects all properties of the category of sets.