EDIT: After what I wrote below I looked at one that I have as a pupae right now and realized that your pupae is far more deformed than I had realized. I didn't even realize that it only has two formed legs and the other four are completely absent. I think the best choice as sad and disappointing as it is, is to euthanize it.
I'll leave what I wrote before just because it might help someone out down the road.
I'd say the best thing to do is just leave it in a handmade pupae cell and keep and eye on it. I personally would create something similar to an "ICU" like tarantula keepers make.
I would clean a deli cup very well. Add paper towels that are moist and shape those into a pupae cell. Make sure the concave area of the cell is relatively smooth or moist enough that the pupae won't snag on it if trying to wiggle. This kind of setting will be much more sterile and won't have the risk of mites and such becoming an extra risk. You wont want it to be too moist but the moisture might help with development and "shedding" of the skin if it makes it to adulthood.
Since the larvae skin is stuck over the head, even if it makes it to an adult beetle it probably won't live long if the head/mouth area is deformed. I guess the only way to find out is to wait and see.
The very best advice I can give though is just to not make any rash decisions. At least for me when I have been in similar situations I have tried to help too much. Things like physically trying to remove the larvae skin that is still attached will only cause more issues since the pupae is so fragile. Just leaving it alone in a controlled environment is the best option I think.