Implement a vanilla recurrent cell with sequential hidden states and optional backpropagation through time gradients.