Alternatively, taking the raw data and converting it to a TIFF, then adding DNG tags as appropriate would work.
I’ve been doing the same to get FITS images from siril back to DNG. ImageMagick’s convert utility to get from FITS to TIFF, rename .tif to .dng, then run the following script to add DNG tags:
#!/bin/sh
exiftool -DNGVersion="1.4.0.0" -DNGBackwardVersion="1.4.0.0" -ColorMatrix1="0.5271 -0.0712 -0.0347 -0.6153 1.3653 0.2763 -0.1601 0.2366 0.7242" \
-IFD0:BlackLevelRepeatDim="2 2" -IFD0:BlackLevel="512 512 512 512" -IFD0:WhiteLevel=16380 \
-PhotometricInterpretation="Color Filter Array" -CalibrationIlluminant1=D65 \
-SamplesPerPixel=1 -IFD0:CFARepeatPatternDim="2 2" -IFD0:CFAPattern2="0 1 1 2" $1
http://www.imagemagick.org/discourse-server/viewtopic.php?t=31451#p143093 might help for converting your specific raw data to TIFF. That example is for 8-bit RGB, but it should be easily adaptable to 16/32-bit monochrome. Note that the CFA patterns and color matrices/black levels above are specific to a Sony A7M3 - you’ll need to change your color matrix, CFA pattern, and such as necessary for your imager. Although the 0x94 indicates you probably have an RGGB CFA like the A7M3.
My concern with the stuff in dcraw.cc is that the location you found for adding your file support is a nasty hack/workaround that attempts to detect something based solely on file size, and the more entries you add to it, the more likely it will break. Especially for monochrome variants of the same sensors… Whether to include this there is not my decision, but it’s my personal opinion that a legacy hack for stuff that predates DNG (and was probably written before DNG existed) really shouldn’t be expanded further for stuff that can more properly be handled via a lossless conversion to DNG.
Edit: For your IMX183 example, the conversion to DNG (before tagging) would probably be:
convert -size 5472x3648 -depth 16 GRAY:in.bin TIFF:out.dng
Assuming your file is 16 bits per sample