How to create syntethic mosaic images

Can somebody tell briefly how to create synthetic images like png in the article Bayer moire?
I tried a lot of approaches.

For example, I tried to convert real dng into a tiff and put data by libtiff in it, but it wasn't successful.

Also, I tried to create tiff with dng tags, which dng SDK validated after converting, but it wasn't successful as well.

Finally, I tried to add dng tags to the tiff image by using ExifTool. After converting, such an image was opened and demosaiced, but it is grayscaled.

RawTherapee, using of which for demosaicing and estimation of colour is my goal, don't see data in such dng.

Tags of exiftool is there:
exiftool -DNGVersion= \
  -PhotometricInterpretation="Color Filter Array" \
  -IFD0:CFAPattern2="0 1 1 2" \
  -IFD0:CFARepeatPatternDim="2 2" \


You can see some examples here

Without coding, just using a simple script with calls to: dcraw.exe, exitfool and dng_validate from Adobe, I have managed to create some synthetic valid DNG files:
- Linear light decomposition to balance different colour temperatures in RAW
- Mean stacking to mimic ultra low ISO/ND filter
- Median stacking to remove moving subjects