While some of that has to do with this bug potentially, the rest is because converting high resolution images to PDF format is incredibly inefficient.
The PDF format is not to blame here. You can encode the images in different ways inside of a PDF document. Apple decided to use a very space-inefficient format for the PDF.
When you scan documents with iOS in Files App, you also get very big PDF files in comparison to dedicated third-pary apps.
In my opinion this is just sloppy programming on Apple#s side.