I retained approximately one ticket in Japan. It was due to walking through a transfer exit gate at some station of the Tokyo Metro, which lets you walk through a non-fare-paid area to re-enter another station.
I also retained all the Shinkansen seat reservation tickets (特急券) back when I had the old-style JR Pass, where you always had to enter/exit stations with help from the station attendant - and not use automatic ticket gates. I haven't tried the current style of JR Pass (since maybe 2022?), but I imagine that the exit gate would eat your seat reservation ticket, just like if you had bought the ticket in cash.