Yes, if you are resizing your input images, you should also resize the masks, too.
However, make sure to use interpolation=PIL.Image.NEAREST, otherwise your class indices might be distorted.
Also, if you are planning on applying random data transformations, I would recommend to use the functional API as described in this post 8 to make sure both the image and mask are using the same random values.