Answer
Build the XML into a CLOB using a temporary LOB, write the XML declaration string directly into that CLOB first (for example, via a document-start writer call followed by appending the literal prolog text), and only then continue building the rest of the document using Xml_Record_Writer_SYS as normal — the declaration line needs to be written directly into the output stream ahead of the record-writer's own element calls rather than being something the record-writer package generates for you automatically.