How to get a correct CIImage/CVPixelBuffer from a ProRaw?

I need to process the ProRaw photo as soon as it is captured. Our flow for the Bayer Raw includes creating an MTLTexture from a CVPixelBuffer. But with ProRaw looks like the problem is even before this step. We need a linear image so I've tried the following sample (adjusted to work on iOS 14):

var options: [CIRAWFilterOption: Any] = [
    .baselineExposure: 0.0,
    .boostAmount: 0.0,
    .boostShadowAmount: 0.0,
    .disableGamutMap: true
]

if #available(iOS 14.3, *) {
    options[.ciInputLocalToneMapAmountKey] = 0.0
}

let pxFilter = CIFilter(cvPixelBuffer: photo.pixelBuffer!, properties: photo.metadata, options: options)!

let pxImage = pxFilter.outputImage!

(ignore all the force unwrappings, it is just a proof of concept)

And the output image is always overexposed here:

How can I get a linear image with proper exposure?

I have a feeling that BlackLevel and WhiteLevel in DNG tags (0 and 4095 respectively) are not correct.

I have some more details. Looks like the ProRaw pixel buffer is not so raw. It has at least some kind of boost. Is it possible to disable it and get a real raw? I mean, demosaic is ok, but everything else breaks our flow.

Take a look at examples. These photos were taken using exactly the same exposure duration and iso. The difference is how much light is on the photo (the second one is actually darker, it doesn't have any local light while the first one has). White level is 4095 for both photos according to the DNG tags (avCapturePhoto.metadata["{DNG}"]["WhiteLevel"]).

How to get a correct CIImage/CVPixelBuffer from a ProRaw?
 
 
Q