You can set the DocumentExporter lognode to trace to get the entire XSL-FO when exporting a document. If you need to obtain this XSL-FO at runtime you could perhaps write a custom logger implementation.
That said, you cannot use (customized) XSL-FO as input for generating documents (in the file formats that we support) after that, so that's something you'd have to do yourself.