The magic of the morphisms 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 $.
 A: If I understand correctly you call it a coincidence the fact that many concrete categories of structures can be encoded as some (sub-categories) of spotted sets (which by the way I would have called pair of sets, because they are very similar to pairs of spaces as studied in the framework of algebraic topology).
This does not come as a suprise to me and it is a consequence of the Bourbakian's belief that any mathematical structure can be encoded as a (family of) set(s) with operations and relations defined on them.
Since every operation/function is traditionally encoded in set theories (such as ZFC) as a relation satisfying certain conditions, one could refine the above mentioned belief saying that every structure is a (family of) set(s) with relations defined on them.
Clearly if you regard structures as sets with relations (that is subsets of cartesian products, that is spotted sets) it becomes clear why all the structures can be embedded in the category of spotted sets.
Hope this answer you question.

Addendum: the following is just some additional material which could be skipped but I think it may be interesting because it somehow correlated to the subject considered (at least in my humble opinion).
You could also encode relations as operations (that is functions on sets): you could see any relation $R \subseteq A_1 \times A_2$ as a pair of functions 
$$(\pi_i \colon A \to A_i)_{i=1,2}$$
satisfying a condition, namely that the pair $(\pi_1,\pi_2)$ is jointly monoic.
In this way you can encode any relational structure as some sort of algebraic structure (over the family of sets $A_1,A_2$) and homomorphisms between such algebras correspond exactly to structure preserving morphisms. 
This kind of algebraic construction is quite common, for instance it used to model many kind of dynamical systems such as finite state automata (and other kind of transition systems) as coalgebras in a opportune categories.
Basically the first kind of encoding (the one that uses relations) can be seen as the process of internalization of mathematical structures in the language of set theory while the second one (the one that uses operations) can be seen as the process of internalization of mathematical structures in the language of category theory.
A: 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.
