Also here in Korea. Although it’s not as common in Japan as Korea, I quite often see guys spitting (or even dribbling) into the urinal before they start peeing. It occurs to me that leaving room for this might encourage standing a bit further back than might be suitable for urination.
As for why they spit in the first place, spitting in general is also more common in Korea (and even more common in China) but I’d wager it was also very common in Japan until Meiji-era authorities thought it ought to be stamped out along with mixed-sex bathing and samurai haircuts. Spitting no longer being allowed on the streets, men are making the most of the toilets, perhaps.
The theory why blowing your nose is okay in Europe and spitting is better in Asia is something to do with what infectious diseases were most common in those two places, but I forget which diseases they were.