All rings/algebras appearing in this question are assumed to be commutative with unity and noetherian.
Let $R$ be a ring, let $A, B$ be $R$-algebras, and let $(B_i)_{i \in I}$ be a family of sub-$R$-algebras of $B$ such that $B = \bigcup_{i\in I} B_i$. I recently came across the following (apparently trivial) claim: $$\mathrm{Hom}_{R-\mathrm{alg}}(A,B) \cong \bigcup_{i\in I} \mathrm{Hom}_{R-\mathrm{alg}}(A,B_i),$$ where $\cong$ denotes an isomorphism of sets, i.e., a bijection.
Now I wonder whether this is actually true (and if yes, how to prove it). I guess that it could be related to the fact that the $\mathrm{Hom}$-functor preserves limits in both its arguments, but I do not see which "kind" of limit I should consider here.
Any help is appreciated!
Let $R=\mathbb{Q}$, and $A=B=\mathbb{R}$. Let $I=\mathbb{R}$ and for $x\in I$ let $$B_x=\mathbb{Q}[x].$$
Then $\mathbb{R}$ is commutative, Noetherian and has unity. Also $B=\bigcup_{x\in I} B_x$. However $1_\mathbb{R}$ is not in $$\bigcup_{x\in I} \mathrm{Hom}_{R-\mathrm{alg}}(A,B_x).$$