Can you beat your camera's jpg-engine when it comes to post-processing RAW files?
Yes. It is trivial to get better results than the in-camera JPEG rendering. And there is no fundamental reason why one can't get the same quality by skillful rendering of the raw file.
Information Theory suggests one should never destroy original data.
1. The technical people responsible for the in-camera firmware have to guess what parameters will best render the image. Yet they will never see the image in person. This is a huge disadvantage compared to the photographer who can select the optimal parameters for a each image during post production. This means it is easy to get better results than strangers who have never seen the image at hand. A better result is one you prefer compared to the stranger(s).
2. With raw the rendered image can be saved in a format that is not lossy. Information is not destroyed if you repeatedly save TIFFs, DNG or PSD images after making small improvements. If you make a change to an in-camera JPEG rendering, then the lossy compression can degrade the image every time a new version is saved. Another difference is many raw rendering programs are nondestructive. They only make virtual changes to the original data. By contrast once the in-camera renders the raw data, it is deleted. One option for in-camera JPEGs is to save both raw and JPEGs to the storage card. Given the processor speed of modern cameras and the low cost of storage, saving raw + in-camwera JPEG files simultaneously is attractive to some photographers.
In the first case consider what happens when the scene is lit by multiple sources with different color temperatures. Rendering with selective color temperature parameters can be superior with raw images because all the data is available. There are several other examples of how destroying data via in-camera JPEG compression is a handicap.
It turns out that if the in-camera color balance is perfect and the exposure is perfect and the dynamic range of the scene does not exceed the sensor's analog dynamic range, then rendering the image from raw data during post-production has no technical advantage over the rendering of an in-camera JPEG. Raw rendering in post production can not perform miracles. It simply gives you the most flexibility if you happen to need it.
There are situations where the convenience and speed of using in-camera JPEGs is important. There are other situations where producing the best possible rendering is not a priority. It would be silly to claim it is
always necessary to have the raw data.
In a prior life I was trained to never destroy original data. It's hard to abandon 27 years of data handling procedures. I never, ever, just use in-camera JPEGs (except for when I use my iPhone camera).