There's nothing medically wrong with the approach, however protein based pharmaceuticals are slow and expensive to manufacture, which isn't ideal when you are trying to vaccinate millions of people, cheaply.
To manufacture a protein you need to create a genetically modified bacteria that contains the DNA for that protein, grow a large batch of this bacteria (which can be difficult at scale), and then break open the bacteria filter out all the other proteins and just keep the one you want.
This is why the mRNA is so elegant, it gives your body the instructions to manufacture the protein itself.