The answer is no to the general question, and also to question (b), for the following simple reason (which works whether or not the space is finite): if $f:X\to X$ is surjective and $f(x)=y$ for some $x\neq y$, then there must be some $w\neq x$ with $f(w)=x$. Thus, the relation $R_{im}$ must have the property that whenever $x\mathrel{R_{im}} y$ and $x\neq y$, then there must be some $w\neq x$ with $w\mathrel{R_{im}} x$. In particular, $R_{im}$ can have no minimal elements, and so there are numerous counterexamples to the main question and question (b).

**Update.** Meanwhile, the answer to (a) is positive for finite sets, as asked in the comments:

**Theorem.** Every equivalence relation on a finite set $X$ arises
as $R_{im}(X,\tau)$ for some topology $\tau$ on $X$.

**Proof.** Suppose that $R$ is an equivalence relation on a finite
set $X$. We may place a linear pre-order $\trianglelefteq$ on $X$ in such
a way that $x\mathrel{R} y$ is equivalent to $x\trianglelefteq
y\trianglelefteq x$. Define the topology $\tau$ to have as open
sets exactly the upward closed sets, which have the form
$U_x=\{y\in X\mid x\trianglelefteq y\}$, plus the empty set. (This
collection is closed under arbitrary unions and intersections.)

I claim that $R_{im}(X,\tau)=R$. First of all, the topology does
not distinguish between points within any $R$-equivalence class,
and so we may permute within them at will. Thus, $R\subset
R_{im}(X,\tau)$. Conversely, suppose that $f:X\to X$ is continuous
and surjective. I claim that $f$ is merely permuting within each
$R$-class. First, note that $f$ is $\trianglelefteq$-preserving:
if $f(x)=y$, then $x$ is in the preimage $f^{-1}(U_y)$, which is
open, and so if $x\trianglelefteq x'$, then since $x'$ is in any
open set that $x$ is in, it follows that $y\trianglelefteq f(x')$,
and so we have $x\trianglelefteq x'\longrightarrow
f(x)\trianglelefteq f(x')$. From this, it follows that $f$ must
take each $R$-equivalence class into a single $R$-equivalence
class. Since $X$ is finite and $f$ is surjective, we know that $f$
is a permutation of $X$, and so $f$ must take the least $R$-class
to itself, and the next and so on, since otherwise we'd violate
the $\trianglelefteq$-preserving property. In other words, $f$ is
merely permuting the points inside each equivalence class, and so
$R_{im}(X,\tau)\subset R$ and hence $R_{im}(X,\tau)=R$, as
desired. **QED**