Yes, such a thing exists, but I don't know an explicit example.
To see that it exists, it is clearest to me to consider the universal situation. For any $k \in \mathbb{Z}$ there is a space $\mathcal{S}_g(k)$ which classifies oriented surface bundles
$$\Sigma_g \to E \overset{\pi}\to B$$
equipped with a class $c \in H^2(E; \mathbb{Z})$ such that $\int_{\Sigma_g} c = k$. Associated to such a family there are characteristic classes
$$\kappa_{i,j} = \int_\pi e(T_\pi E)^{i+1} \cdot c^j \in H^{2(i+j)}(B;\mathbb{Z}),$$
where $T_\pi E$ denotes the tangent bundle of $E$ along the fibres of $\pi$, and $e(T_\pi E)$ denotes its Euler class. (The classes $\kappa_{i,0}$ are the usual Miller--Morita--Mumford classes $\kappa_i$.)
In
J. Ebert and O. Randal-Williams, Stable cohomology of the universal Picard varieties and the extended mapping class group. Doc. Math. 17 (2012), 417–450.
Johannes Ebert and I studied, among other things, the low-dimensional integral cohomology of $\mathcal{S}_g(k)$, and showed that as long as $g$ is large enough (I think $g \geq 6$ will do) one has
$$H^1(\mathcal{S}_g(k);\mathbb{Z})=0 \quad\quad H^2(\mathcal{S}_g(k);\mathbb{Z})\cong\mathbb{Z}^3$$
where the isomorphism in the second case is given by a basis of cohomology classes $\lambda, \kappa_{0,1}, \zeta$, where the outer two are related to the $\kappa_{i,j}$ by the identities
$$12 \lambda = \kappa_{1,0} \quad\quad 2\zeta = \kappa_{0,1} - \kappa_{-1,2}.$$
In particular, applying this with $k=0$ and using that every second homology class is represented by a map from an oriented surface, it follows that there is a surface bundle
$$\Sigma_g \to E \overset{\pi}\to \Sigma_h$$
for some $h$ (which is uncontrollable using this method) with a class $c \in H^2(E;\mathbb{Z})$ satisfying $\int_{\Sigma_g}c = 0$, and having
$$\int_{\Sigma_h}\lambda=\text{whatever you like} \quad\quad \int_{\Sigma_h}\kappa_{0,1}=1 \quad\quad \int_{\Sigma_h}\zeta = 0$$
and hence having
$$\int_E c^2 = \int_{\Sigma_h} \int_\pi c^2 = \int_{\Sigma_h} \kappa_{-1,2} = \int_{\Sigma_h} \kappa_{0,1} = 1.$$