Foreign investors have bought $34.6 billion of Japanese stocks this year, the largest net inflow since 2013.