I also have that $\rho(t_0)=\rho_0$ and $a(t_0) = 1$.
I'm trying to separate the variables here to reach the desired solution, with my working as follows:
\begin{align*} \frac{\dot{\rho}}{\rho} &= -3\frac{\dot{a}}{a}\left[ 1 + w(t) \right] \\ \int_{t_0}^a \frac{\dot{\rho}}{\rho} \mathrm{dt} &= -3\int_{t_0}^a\frac{\dot{a}'}{a'}\left[ 1 + w(t) \right]\mathrm{dt} \\ \ln{\rho(a)} - \ln{\rho(t_0)}&=-3\int_{1}^a\frac{\dot{a}'}{a'}\left[ 1 + w(t) \right]\mathrm{dt} \\ \rho(a)&=\rho_0 \exp \left(-3\int_{t_0}^a\frac{\dot{a}'}{a'}\left[ 1 + w(t) \right]\mathrm{dt}\right)\\ \rho(a)&=\rho_0 \exp \left(3\int_{a}^1\frac{\mathrm{da'}}{a}\left[ 1 + w(a') \right]\right) \end{align*}
I'm not convinced that my manipulation of limits is correct (changing $t_0$ to 1 when changing $\mathrm{dt}$ to $\mathrm{da'}$) and I also don't entirely understand how the dependencies have been written in the solution. Why is it valid to change $w(t)$ to $w(a')$? If the integral on the LHS is changing the dependency of $\rho$ from $t$ to $a$, mustn't the RHS be integrated before we can do the same to $w$? Is it even valid to have $a$ as a limit of integration if integrating w.r.t $t$?

Physically, it doesn't make sense to integrate with bounds of $t_0$ and $a$ because they don't have the same units ($t$ is time, $a$ is unitless). I assume they did something like this: $$\begin{aligned} \frac{\dot{\rho}}{\rho}&=-3\frac{\dot{a}}{a}[1+w(t)]\\ \int_{t_0}^t \frac{\dot{\rho}(t')}{\rho(t')}\,dt'&=-3\int_{t_0}^t \frac{\dot{a}(t')}{a(t')}[1+w(t')]\,dt'\\ \int_{\rho_0}^{\rho(t)} \frac{1}{\rho'}\,d\rho'&=-3\int_1^{a(t)}\frac{1}{a'}[1+w(a^{-1}(a'))]\,da'\\ \rho(t)&=\rho_0 \exp\left(3\int_{a(t)}^1 \frac{da'}{a'}[1+w(a^{-1}(a'))]\right). \end{aligned}$$ Since $\rho$ and $w$ are functions of $t$, and $a$ is a function of $t$, you can also express $\rho$ and $w$ as functions of $a$. You can then abuse notation a bit to write $$\rho(a)=\rho_0 \exp\left(3\int_a^1 \frac{da'}{a'}[1+w(a')]\right).$$ Here, $t'$, $\rho'$, and $a'$ are used only as "dummy variables" so that $a$, $\rho$, or $t$ do not appear in both the integrand and the limits.
These $\rho(a)$ and $w(a')$ are not the original functions $\rho(t)$ and $w(t)$ evaluated at $t=a$ and $t=a'$, respectively. They are functions of $a$ obtained by taking the original $\rho(t)$ and $w(t)$, substituting $t=f(a)$ (whatever $f$ may be), and then calling these new functions $\rho(a)$ and $w(a)$. Then $w(a')$ is $w(a)$ evaluated at $a=a'$.
It's probably easier to interpret $\rho(t)$, $\rho(a)$, $w(t)$, and $w(a)$ as the quantities $\rho$ and $w$ expressed as functions of $t$ or $a$, rather than the functions $\rho$ and $w$ evaluated at the values $t$ or $a$.
There is a bit of abuse of notation going on, so if you wanted to be clear, you could write the original functions as $\rho_1(t)$ and $w_1(t)$, and the final functions as $\rho_2(a)\equiv\rho_1(t(a))$ and $w_2(a)\equiv w_1(t(a))$.