They are 2 different concepts.
Sequences are packed to ignore padding and improve the efficiency and even accuracy (intuitively, padding adds noise) in return.
And the loss function is related to the final prediction. Here you no longer care about padding, you need padding just to pass the RNN step. ignore_index=0 in CrossEntropyLoss means if true label is 0 then this particular loss is ignored (does not contribute to the already accumulated loss).
In the example below, the first instance (logits[0]) does not contribute to the final loss because its true label is 0 and we ignore such instances:
torch.nn.CrossEntropyLoss(ignore_index=0)(torch.randn(2, 3), torch.tensor([0, 2]))