Consider the expression $$\sum_{n\in\mathbb {Z}}q^{2n^2+n}$$ which equals Ramanujan theta function $f(q, q^3)=\psi(q)$. Thus the RHS of the given identity equals $$\psi(q) - 3q\psi(q^9)$$ Ramanujan says in his notebooks that the following identity holds $$\psi(q) - 3q\psi(q^{9})=\frac{\phi(-q)} {\chi(-q^3)}$$ where $$\phi(-q)=\prod_{n=1}^{\infty} \frac{1-q^n}{1+q^n}$$ and by definition $$\chi(q) =\prod_{n=1}^{\infty}(1+q^{2n-1})$$ so that your identity holds.

The proof of Ramanujan's identity is provided by Bruce C. Berndt in his *Ramanujan's Notebooks Vol. 3* in chapter 20, page 349, Entry 2 (ii).

Here is a complete proof based on Ramanujan's ideas presented in Berndt's book.

The following are definitions of Ramanujan theta functions:
\begin{align}
f(a, b) &=\sum_{n\in\mathbb {Z}} a^{n(n+1)/2}b^{n(n-1)/2}\notag\\
\phi(q)&=f(q,q)\notag\\
\psi(q) &=f(q, q^3)\notag\\
\chi(q)&=\prod_{n\geq 1}(1+q^{2n-1})\notag
\end{align}
and Jacobi Triple Product identity reads as $$f(a, b) =\prod_{n\geq 1}(1-(ab)^n)(1+a(ab)^{n-1})(1+b(ab)^{n-1})$$

Let's observe that $$\psi(q^{1/3})=\sum_{n\geq 0}q^{n(n+1)/6}=1+q^{1/3}+q+q^{2}+q^3q^{1/3}+q^5+q^{7}+q^{9}q^{1/3}+\dots$$ The terms corresponding to $n=1\pmod 3$ contain a factor $q^{1/3}$ and other terms don't contain any fractional powers of $q$. If $n=(3m+1)$ then $$\frac{n(n+1)}{6}=\frac{3m(m+1)}{2}+\frac{1}{3}$$ and hence such terms combined can be written as $q^{1/3}\psi(q^3)$ and thus we have $$\psi(q^{1/3})=q^{1/3}\psi(q^3)+\sum_{n=0\pmod 3}q^{n(n+1)/2}+\sum_{n=2\pmod 3}q^{n(n+1)/2}$$ The remaining two sums can be combined to form $$\sum_{n\in\mathbb{Z}} q^{n(3n+1)/2}=f(q,q^2)$$ and thus we arrive at $$\psi(q^{1/3})=q^{1/3}\psi(q^3)+f(q,q^2)\tag{1}$$ We next apply the same technique with $$\phi(-q^{1/3})=\sum_{n\in\mathbb {Z}} (-1)^nq^{n^2/3}$$ The sum on the right can be expressed as $$\sum_{n\in\mathbb {Z}}(-1)^nq^{3n^2}+\sum_{n=1\pmod 3}(-1)^nq^{n^2/3}+\sum_{n=-1\pmod 3}(-1)^nq^{n^2/3}$$ which is the same as $$\phi(-q^3)-q^{1/3}\sum_{n\in\mathbb {Z}} (-1)^nq^{3n^2+2n}-q^{1/3}\sum_{n\in\mathbb {Z}} (-1)^nq^{3n^2-2n}$$ The last two sums are same as is evident by changing index $n$ into $-n$ and therefore we have
\begin{align}
\phi(-q^{1/3})&=\phi(-q^3)-2q^{1/3}\sum_{n\in\mathbb {Z}} (-1)^nq^{3n^2+2n}\notag\\
&=\phi(-q^{3})-2q^{1/3}f(-q,-q^5)\tag{2}
\end{align}
Next note that
\begin{align}
f(-q, - q^5)&=\prod_{n\geq 1}(1-q^{6n})(1-q^{6n-5})(1-q^{6n-1})\notag\\
&=\prod_{n\geq 1}\frac{1-q^{6n}}{1-q^{6n-3}}\prod_{n\geq 1}(1-q^{6n-1})(1-q^{6n-3})(1-q^{6n-5})\notag\\
&=\psi(q^3)\chi(-q)\tag{3}
\end{align}
Therefore $(2)$ can be recast as $$\phi(-q^{1/3})=\phi(-q^3)-2q^{1/3}\chi(-q)\psi(q^3)\tag{4}$$ Using similar manipulation we can write $$f(q, q^2)f(-q,-q^5)=\prod_{n\geq 1}(1-q^{3n})(1-q^{6n})=\psi(q^3)\phi(-q^3)\tag{5}$$ We can combine equations $(1)-(5)$ and prove Ramanujan's identity mentioned earlier and thus complete the proof of the identity in question.

Thus starting from $(1)$ we have
\begin{align}
\frac{\psi(q^{1/3})}{q^{1/3}\psi(q^3)}&=1+\frac{\phi(-q^3)}{q^{1/3}f(-q,-q^{5})}\text{ (via (5))}\notag\\
&=3+\frac{-2q^{1/3}f(-q,-q^5)+\phi(-q^{3})} {q^{1/3}f(-q,-q^5)}\notag\\
&=3+\frac{\phi(-q^{1/3})}{q^{1/3}f(-q,-q^5)}\text{ (via (2))}\notag\\
&=3+\frac{\phi(-q^{1/3})}{q^{1/3}\psi(q^3)\chi(-q)}\text{ (via (3))}\notag
\end{align}
Replacing $q$ by $q^3$ we get Ramanujan's identity.