No processing will restore what's lost, so from technical POV RAW is 'the best quality' (this should apply to geometric distortions as well).
This absurd. If by "quality" you mean anything to do with how humans perceive the image, then your claim is complete nonsense. If by quality you just mean the best source data for transformation to something humans perceive (or for analytical purposes that don't involve rendering an image), you have a point, but it's not what most people mean when they talk about image quality.
Modern compact cameras are designed with severe distortion in the lenses *because the designers knew they could correct it in software*.
For the purpose of accurately reproducing a scene *as a human would see it*, an image with the distortion uncorrected is clearly lower quality than an image in which the distortion has been corrected. Software cannot add back data that was never recorded, but it certainly can transform that data into something that provides a more accurate representation *to a human viewer*. You cannot correct barrel distortion in your head. A computer can, and to a human, the resulting image is undeniably a more accurate representation of the original scene.