Prime minister wins crucial Commons votes on legislation but Conservative divisions are laid bare