Yeah, the i5-8400 has a locked multiplier, so it can't really be overclocked, at least not in any significant way. However, for gaming, its stock performance tends to be slightly faster than that of an overclocked Ryzen 1600 in most of today's games, so it's still perhaps slightly better for that purpose if you ignore price.
Both CPUs have six cores, but unlike the 8400, the Ryzen 1600 has SMT (AMD's equivalent to Hyperthreading), so in loads that can make heavy use of more than six cores, the 1600's performance can pull ahead. Currently, this doesn't apply to many games though, as the vast majority still tend to be optimized to run well on quad-core processors, though if heavily multithreaded titles become more common in the coming years, they could potentially run better on the 1600. Or, in the short term, if someone were live-streaming their gaming session using a CPU-based video encoder, the additional threads of the 1600 might help maintain smooth performance. And of course, the additional threads could help reduce the time for doing things like encoding videos outside of gaming.
On the other hand, in CPU-limited games that primarily rely on high performance per-core or are optimized for Intel's CPUs, the 8400 can pull ahead. As I mentioned before, they're both arguably good CPUs, each with their own strengths. The current requirement for Z370 board's kind of hurts the value of the 8400 though, especially in cases where your graphics card or standard refresh-rate monitor will be limiting performance most of the time.
Here's one article that I thought did a reasonably good comparison between the i5-8400 and an overclocked 1600...
https://www.techspot.com/review/1514-core-i5-8400-vs-overclocked-ryzen-5-1600/
Just keep in mind that they are testing with a high-end RX Vega 64 graphics card to exaggerate any differences, including at the very low resolution of 720p. If you were using a mid-range graphics card at 1080p, your results would likely be more comparable to their 1440p results, where the graphics card will be limiting your performance more than anything, and any of the tested processors will perform practically identical in today's games. Also note that their price comparison was based on the pricing of these processor's a few months ago, at Coffee-lake's launch. The Ryzen 1600 has since come down around 10% in price.
You did mention the Ryzen costing significantly more where you are though? Was that for the 1600, or the 1600X? Here, at least, the 1600 is now very close in price to the 8400. If it were different enough where you are, to the point where the higher cost of a Z370 board were cancelled out, then that could potentially push the value back toward the 8400.
And there is the 8600k like you mentioned, which can be faster than either of these CPUs by a decent margin when overclocked. Of course, unless you have a higher-end video card, or are running games at low resolutions or settings, your performance in most of today's games will still likely be quite similar to the other processors. Perhaps in the future, as games get more demanding, the 8600k's performance could make more of a difference though. It does carry a price premium for that unlocked multiplier though. Here at least, the 8600k costs around 35% more than the 8400 right now.