Government to rein in legal challenges against itself in Tory ‘attack on democracy’