The short answer is that you're right: creating new values at
custom-print time creates trouble for graph detection and `print`
quoting. Those operations perform a pass to make decisions about graphs
and quoting based on `eq?` identity, and then they make another pass to
actually print. I'll update the documentation to clarify.
A longer answer is that your example and variations expose several
mismatches between the `racket/pretty` printer, the built-in printer
for current Racket, and the built-in printer for Racket CS. I'm working
on changes and tests to make them more consistent, but the changes
don't produce the result you wanted. If you put `maybe-rebuild` in
`custom-print`, then they more consistently produce the output that you
don't want.
Of course, an even better improvement would collapse the three
different implementations of the printer. One day, we may be able to
use the Racket CS I/O layer in place of the implementation in current
Racket, and then folding in pretty-print support may become practical.