I find this is not really true. This depends a LOT on the context in Japan. If you are in the train or in the street, yeah, it's not the right place to do that. But there are plenty of other places where such interactions happen naturally. Go in a bar? People will start talking to you. Go have dinner in a small izakaya? There's a good chance people will talk to you. Visit a tourist spot? There's a good probability something like that will happen as well. And not just with foreigners, this happens with locals as well.
So, it's far from being black or white. Just like a lot of statements I hear the whole time about Japan.