From what I've read, those rockets did and didn't fly over Japan. Or rather, even though they did fly over Japan, they flew too high to violate Japanese airspace, which as with every other country's airspace only extends to a certain height above ground level.
Contrary to what we are told, NK has continued on the nuclear path because the US always refused to stop threatening their security by holding huge military drills near their SK border and sailing aircraft carriers close to their territorial waters.