Minimal example (you can use this tiny PNG for example):
from PIL import Image
image = Image.open('test.png')
image = image.convert('P')
image.save('test.pdf')
Output PDF with Pillow 10.0.1:

Output PDF with Pillow 10.1.0:

Issue faced with Python 3.11.6 on Ubuntu 22.04 and Debian 12 (bookworm). I also had the same issue in Docker environments, so I could make a Docker image if needed.