It is possible to print the version number of LilyPond in markup.
\version "2.24.0" \markup { Processed with LilyPond version #(lilypond-version) }