The inspection takes place 3 years after buying a new car and every 2 years after that. It is not based on mileage. The inspection itself only costs ~2000yen (~$15), but you also pay weight fees and insurance. Insurance runs about 25,000jpy (~$200) and the weight fees vary based on age and weight. A 2000-3000 lb car costs 25,000-40,000 yen ($200-300) depending on age. A 3000-4000 lb car costs ~30,000-50,000 yen (~$225-400).
So if your 20 year old Civic can still pass inspection, shaken will cost a bit over $500 every 2 years. The problem is not many Japanese have space/knowledge/inclination to work on their own cars, so most have to take the car to the shop for every minor repair.
The average 2002 Civic I see would completely fail Japanese inspection. Any torn seats? Fail. Any leaks? Fail. Any rust on suspension/chassis? Fail. Any worn bushings? Fail. Speedometer read 39 when you're doing 40? Fail. Now you could probably buy a complete gasket kit and all new suspension bushings for maybe $1,000-$1,500, but if you had to pay a mechanic to do that work you'd probably be looking at a $5,000 repair bill on your $2,000 car. So you sell it instead.
As for the 60,000 km JDM engine myth - it is just that, a myth. Look at 2000-2004 Honda Civics for sale from Japan and of the 28 I see, only 2 of them have less than 60,000 km:
https://carfromjapan.com/cheap-used-...0&maxYear=2004
The median mileage is more like 142,000 km (~90,000 miles). Still much less than the average 2000-2004 Civic in America, but more than double what everyone assumes...