From pg. 64 of Categories for the Working Mathematician:
If $$ E = \{(fx, gx) \mid x \in X \} \subset Y \times Y, $$
I can see how $[\text{im}(f) \cup \text{im}(g)] / E$ makes sense, but might not $Y / E$ fail to make sense since there might be elements in $Y$ that aren't related by $E$?

In an equivalence relation $E$ on a set $Y$, all $(y,y)$ are elements of $E$. So to construct the least equivalence relation containing some relation $R$ we must (i) throw in all $(y,y)$ for $y\in Y$, (ii) all $(x,y)$ and $(y,x)$ where $(x,y)\in R$ and (iii) all $(x,z)$ when we already have $(x,y)$ and $(y,z)\in R$.