To my best of knowledge, raw RGB images contain a FITS keyword that indicates the Bayer pattern OR are DSLR raw images (CR2, CR3, etc). Once PI has processed them, they will be XSIF images (unless, with all due respect, the user is stubborn). The un-deBayered XSIF images contain a Bayer keyword as well which IIRC gets removed once the image has been deBayered.
For images of digital cameras in the proprietary raw format (e.g. Canon: CR2, Nikon: NEF, Sony: ARW) your statement is correct, the bayer/mosaic pattern is handled by the RAW module and the raw image decoder LibRaw. When the image is saved in XISF format, the bayer/mosaic pattern is stored as a property of the XISF file.
However, for images in FITS format of above mentioned digital camera and astro OSC cameras (CCD cameras, or CMOS cameras) the capturing software either generates FITS keywords (BAYERPAT, XBAYROFF, YBAYROFF) that characterize the bayer/mosaic pattern or not. When these FITS keywords exist, PixInsight will evaluate them and when the image is saved in XISF format, the bayer/mosaic pattern is stored as a property of the XISF file. However, there are capturing programs (e.g. SGP) that currently do not generate these FITS keywords. In these cases, no property corresponding to the bayer/mosaic pattern will be stored in the XISF file. In this case, the bayer/mosaic pattern for the debayering process has to be be set by the user ('Auto' will lead to the error message: "*** Error: Unable to acquire CFA pattern information: Required image metadata not available.".
Bernd