Thermodynamical and dynamical stability of Einstein–Maxwell and extremal Einstein–Born–Infeld thin shells in $$(2 \mathbf {+}\ 1)$$ dimensions