Modified Einstein-Gauss-Bonnet gravity: Riemann-Cartan and pseudo-Riemannian cases