My question is about a possible generalization of the following structure theorem of locally compact abelian groups.
Theorem: Let $G$ be a locally compact abelian group. Then here exists a compact subgroup $K$ and a non-negative number $n\in\mathbb{N}$ such that $\mathbb{R}^n\times K$ is isomorphic to an open subgroup of $G$.
I wonder whether it is possible to generalize the above for non-abelian but nilpotent groups.
The most simple case is when $G$ is nilpotent of order $3$. In this case $[G,G]$ is an abelian group, hence $[G,G]$ satisfies the Theorem. Moreover $G/[G,G]$ is always an abelian group and so satisfies the Theorem.
Can we deduce that $G$ also satisfies the theorem?
No, this isn't necessarily true for nilpotent groups. Take the Heisenberg group $$H_3(\Bbb{R})=\left\{\begin{pmatrix} 1 & a & c\\ 0 & 1 & b\\ 0 & 0 & 1\\ \end{pmatrix}\middle|a,b,c\right\}.$$ It is a nilpotent group which is diffeomorphic to $\Bbb{R}^3$. In particular it is connected, so its only open subgroup is itself. However, it is not isomorphic as a group to $\Bbb{R}^3$ since it's not abelian.