  The formation of highly magnetized young neutron stars, called magnetars, is
still a strongly debated question. A promising scenario invokes the
amplification of the magnetic field by the Tayler-Spruit dynamo in a
proto-neutron star (PNS) spun up by fallback. Barr\`ere et al. 2023 supports
this scenario by demonstrating that this dynamo can generate magnetar-like
magnetic fields in stably stratified Boussinesq models of a PNS interior. To
further investigate the Tayler-Spruit dynamo, we perform 3D-MHD numerical
simulations with the MagIC code varying the ratio between the
Brunt-V\"ais\"al\"a frequency and the rotation rate. We first demonstrate that
a self-sustained dynamo process can be maintained for a Brunt-V\"ais\"al\"a
frequency about 4 times higher than the angular rotation frequency. The
generated magnetic fields and angular momentum transport follow the analytical
scaling laws of Fuller et al. 2019, which confirms our previous results. We
also report for the first time the existence of an intermittent Tayler-Spruit
dynamo. For a typical PNS Brunt-V\"ais\"al\"a frequency of $10^{3}\,{\rm
s}^{-1}$, the axisymmetric toroidal and dipolar magnetic fields range between
$1.2\times 10^{15}-2\times 10^{16}\,{\rm G}$ and $1.4\times 10^{13}-3\times
10^{15}\,{\rm G}$, for rotation periods of $1-10\,{\rm ms}$. Thus, our results
provide numerical evidence that our scenario can explain the formation of
magnetars. As the Tayler-Spruit dynamo is often invoked for the angular
momentum transport in stellar radiative zones, our results are also of
particular importance in this field and we provide a calibration of the Fuller
et al.'s prescription based on our simulations, with a dimensionless
normalisation factor of the order of $10^{-2}$.
