Not always. Here is an answer in the realm of Lie algebras, and below I'll make it an answer in the realm of $p$-groups (a counterexample of order $p^{10}$ and class $5$ (and exponent $p$) in which every proper subgroup has class $\le 3$).
Fix an arbitrary ground field. Consider the vector space of basis $(e_i)_{1\le i\le 10}$. Make it a Lie algebra with the brackets (using the shortcut $i.j|x$ to mean $[e_i,e_j]=x=-[e_j,e_i]$, and other brackets being meant to be zero):
\begin{gather*} 1.2|e_3,\qquad 1.3|e_4,\;2.3|e_5,\qquad 1.4|e_6,\;1.5|e_7,\;2.4|e_7,\;2.5|e_8 \\ 1.7|e_9,\;2.7|-2e_9,\;1.8|e_{10},\;2.7|-2e_{10}. \end{gather*}\begin{gather*} 1.2|e_3,\qquad 1.3|e_4,\;2.3|e_5,\qquad 1.4|e_6,\;1.5|e_7,\;2.4|e_7,\;2.5|e_8 \\ 1.7|e_9,\;2.6|-2e_9,\;1.8|e_{10},\;2.7|-2e_{10}. \end{gather*}
Then this satisfies Jacobi, and also satisfies that $[x,[x,[x,[x,y]]]]=0$ for all $x$, $y$ in the Lie algebra; the latter making use of the choice of $-2$ coefficients.
This is also a (Carnot) graded Lie algebra with $e_1$, $e_2$ of degree $1$, $e_3$ of degree $2$, $e_4$, $e_5$ of degree $3$, $e_6$, $e_7$, $e_8$ of degree $4$, and $e_9$, $e_{10}$ of degree $5$.
One then sees that the natural action of $\mathrm{GL}_2$ in the degree 1 space extends to the whole Lie algebra.
(Well, this Lie algebra was precisely produced to satisfy this, namely starting with the 2-generator free 5-step-nilpotent Lie algebra, observing that the degree 5 component splits as $\mathrm{GL}_2$-module as sum of a 4-dimensional and a 2-dimensional module, and killing the 4-dimensional module. The resulting Lie algebra is the free Lie algebra in the variety of 5-step-nilpotent Lie algebras satisfying the additional law $[x,[x,[x,[x,y]]]]=0$.)
Hence, all codimension-1 subalgebras of the above Lie algebra are isomorphic. Hence it is enough to see that a single one, say the one with basis $(e_i)_{2\le i\le 10}$ is 3-step nilpotent. Namely, its derived subalgebra has basis $(e_5,e_7,e_8,e_9,e_{10})$ and the next step in the central series has basis $(e_8,e_{10})$ and is central therein.
Now consider this Lie algebra over $\mathbf{Z}/p\mathbf{Z}$ with $p>5$. Then Lazard proved that the Baker–Campbell–Hausdorff formula produces a group law for which the lower central series coincides with the Lie-algebraic one, and subgroups also coincide with subalgebras. Thus the resulting group works.