It shouldn't be hard to make a modified version of one of the standard
functions format-mark-alphabet, format-mark-numbers, ... that are
available
in LilyPond and use
\set Score.markFormatter = #whatever-I-call-my-own-fancy-formatter
However, the automatic incrementation of the number is implemented in
C++ today and only handles a single counter, so if you want two of them
(I'm not sure I understand exactly what you want), you would probably
have
to handle the other counter as a property that is read and set by
your formatter
function.