First note that $G=X_TY_T\mathrm e^{-T/2}$ where the processes $X$ and $Y$ are defined for every $t\geqslant0$ by $X_t=B_t^2-t,\qquad Y_t=\mathrm e^{B_t-t/2}. $ The identity $M^T_t=E[X_TY_T\mid\mathcal F_t]$ defines a martingale $(M^T_t)_{0\leqslant t\leqslant T}$ such that $M^T_T=X_TY_T$ and $M^T_0=E[X_TY_T]$. Thus, $\mathrm dM^T_t=K^T_t\mathrm dB_t$ for some process $(K^T_t)_{0\leqslant t\leqslant T}$, and $G=\mathrm e^{-T/2}M^T_0+\mathrm e^{-T/2}\int_0^TK^T_t\mathrm dB_t. $ To sum up, this warm up paragraph shows that it suffices to identify $M_0^T$ and the process $K^T$.
You already know that $M_0^T=T^2\mathrm e^{-T/2}$. To identify $K^T$, fix some $t\lt T$, define $u=T-t$, and consider the processes $\bar B$, $\bar X$ and $\bar Y$ defined for every $s\geqslant0$ by $\bar B_s=B_{t+s}-B_t,\qquad\bar X_s=\bar B_s^2-s,\qquad\bar Y_s=\mathrm e^{\bar B_s-s/2}. $ Then, $ X_TY_T=((B_t+\bar B_u)^2-t-u)Y_t\bar Y_u=X_tY_t\bar Y_u+2B_tY_t\bar B_u\bar Y_u+Y_t\bar B_u^2\bar Y_u. $ Since $\bar B$ is independent of $\mathcal F_t$ and $(\bar B,\bar Y)$ is distributed like $(B,Y)$, this yields $ M_t^T=E[X_TY_T\mid\mathcal F_t]=A_0(T-t)X_tY_t+2A_1(T-t)B_tY_t+A_2(T-t)Y_t, $ where, for every integer $k\geqslant0$, $ A_k(u)=E[B_u^kY_u]. $ Since one already knows that $M^T$ is a martingale, one is only interested in the martingale part of the RHS of the last identity above giving $M_t^T$. Note that $\mathrm dX=2B\mathrm dB$ and $\mathrm dY=Y\mathrm dB$, hence the martingale part of $\mathrm d(BY)$ is $Y(B+1)\mathrm dB$ and the martingale part of $\mathrm d(XY)$ is $Y(X+2B)\mathrm dB$.
To compute the functions $A_k$ for $0\leqslant k\leqslant2$, note that, for every $x$, the identity $ Y^x_u=\exp((1+x)B_u-(1+x)^2u/2)=Y_u\exp(xB_u-xu-x^2u/2), $ defines a martingale $Y^x$ such that $Y^x_0=1$ hence $E[Y^x_u]=1$ for every $u\geqslant0$. Expanding this in powers of $x$ yields $ E[Y_u]=1,\quad E[(B_u-u)Y_u]=0,\quad E[((B_u-u)^2-u)Y_u]=0, $ that is, $ A_0(u)=1,\quad A_1(u)=uA_0(u)=u,\quad A_2(u)=2uA_1(u)-(u^2-u)A_0(u)=u^2+u. $ Finally, for every $0\leqslant t\leqslant T$, $ K_t^T=(B_t^2-t+2(T-t+1)B_t+(T-t)^2+3(T-t))\cdot\mathrm e^{B_t-t/2}. $