There are around 100 train companies in Japan. JR is 7 of those 100. The other 93 are NOT JR. Drawing any conclusions about Japanese trains from inspecting 7% of them is just wrong.
The title, "How Japan's railways stayed one" is just false. They were never one, they are still not one.
Take Tokyo, off the top of my head there is Toei, Tobu, Odakyu, Keio, Seibu, Tokyu, Keikyu, Tokyo Metro, ... and JR
If you're in Shibuya. You can take JR (4 lines: Yamanote, Saikyo, Shinjuku-Shonan, N-EX), Keio (1 line: Inokashira), Eiden (3 lines: Ginza, Hanzomon, Fukutoshin), Toyku (2 lines: Den-en-toshi, Toyoko)
Or Osaka, there's Hanshin, Hankyu, Kentetsu, Nankai, ... and JR
Those others, except maybe 1, are all private, and have always bene private. Even JR's 7 are now private and they were originally private, there was a middle period where the government took them over. It was the period where they nearly went bankrupt, had extremely bad performance.