Writing a custom legacy backend is simple.  Create a file named
gnet-backend-name.scm and define a function
backend-name in it.  Then put the file into one of the
directories lepton-netlist searches for Scheme files.
For instance, create a file gnet-my-backend.scm in the directory ~/.local/share/lepton-eda/scheme with the following contens:
(use-modules (netlist schematic)
             (netlist schematic toplevel))
(define (my-backend output-filename)
  (display (schematic-nets (toplevel-schematic)))
  (newline))
Check that lepton-netlist outputs its name in the list of known backend names:
$ lepton-netlist --list-backends ... my-backend ...
And you can already try it:
$ lepton-netlist -o - -g my-backend my-schematic.sch (GND 1 2 unnamed_net1)
That’s all!