$\newcommand{\Spec}{\mathrm{Spec}\,}\newcommand{\cO}{{\cal{O}}}\newcommand{\cE}{{\cal{E}}}\DeclareMathOperator{\Sect}{Sect}$Here is an example where $\pi:E'\to X$ cannot be given a structure of a vector bundle.
Let $X$ be the projective line $\mathbb{P}^1_k$ over some field $k$, take $E=X\times\Spec k[t]$ to be the total space of a trivial rank $1$ bundle on $X$ and let $\cE'$ be a rank $2$ vector bundle arising as an extension $$0\to \cO_{E}(-2)\to \cE'\to \cO_{E}\to 0$$ whose class in $H^1(E,\cO_{E}(-2))=H^1(X,\cO_X(-2))\otimes_k k[t]$ equals $c\otimes t$ where $c\in H^1(X,\cO_X(-2))\simeq k$ is a non-zero class. Take $E'$ to be the total space of $\cE'$ over $E$.
Let's analyze the functor $\Sect_XE'$ on $k$-algebras that sends a $k$-algebra $R$ to the set of sections of the morphism of $R$-schemes $\pi_R:E'_R\to X_R$. If $E'$ was isomorphic to the total space of a vector bundle on $X$, this functor would be represented by the affine space corresponding to the finite-dimensional vector space of global sections of that vector bundle.
But I claim that in this case $\Sect_X E'$ is represented by $\Spec k[x,t]/(xt)$. Indeed, a section of $\pi_R$ defines a section of $X_R\times\mathbb{A}^1_R\to X_R$ which is necessarily given by a constant function defined by some $t\in R=\mathbb{A}^1(R)$. For a given $t$, sections of $\pi_R$ lying above the section of $E\to X$ given by $t$ are in bijection with $H^0(X_R, \cE'|_{X_R\times \{t\}})$. Writing out the cohomology exact sequence airising from the extension defining $\cE'$ we get
$ H^0(X_R, \cO_{X_R}(-2))\to H^0(X_R, \cE'|_{X_R\times\{t\}})\to H^0(X_R, \cO_{X_R})\to H^1(X_R, \cO_{X_R}(-2)) $
where the last map $R=H^0(X_R, \cO_{X_R})\to H^1(X_R, \cO_{X_R}(-2))=R\cdot c$ sends $r\in R$ to $rt\cdot c$. The first term $H^0(X_R, \cO_{X_R}(-2))$ vanishes, so $H^0(X_R, \cE'|_{X_R\times\{t\}})$ is identified with the set of $r\in R$ such that $t\cdot r=0$. The functor sending $R$ to the set of pairs $r,t$ with $r\cdot t=0$ is exactly represented by $\Spec k[x,t]/(xt)$, as claimed.
This scheme is clearly not an affine space, so $\pi$ cannot be endowed with a structure of a vector bundle.