You know you need to use the 8400 on a z370 board to achieve its optimum performance too right? You can check here
https://www.techspot.com/review/1608-core-i5-8400-vs-ryzen-5-1600-best-value/page3.html
Yes, I'm aware of that, but the difference is that the 8400 only suffers a ~5% performance hit by using DDR4-2666 instead of 3200, in some games the difference is like 2%, so from a value perspective it makes sense, as you are saving $30 on a B360 and another $30 - $40 on DDR4-2666 instead of 3200, for a ~5% performance hit. AMD would suffer a much bigger performance hit if you were to use DDR4-2666 memory, if you don't believe me, ask Steve to test it out.
My point is that, to even approach 8400 levels, you need a fully tweaked 2600 @ 4.2GHz, which requires
1. a decent aftermarket HSF, as the small Stealth HSF won't cut it for 4.0GHz+ overclocks
2. CL14 3200 DDR4 memory, preferably 'B Die' modules
All of which doesn't come free - the 2600 is already $20 more than a 8400, a decent budget HSF like the Hyper 212 costs $30, and even the cheapest CL14 3200 kits are generally around $200 or more, which is about $40 more than a 2666 kit. You also get much higher power consumption from the AMD system because you are comparing an overclocked system to a stock one, so the energy bill difference would mount up over the course of a year or two.
Assuming B350 and B360 motherboards cost the same (they pretty much do), you end up paying $90 more than the 8400 platform. Again, I reiterate that if any highly multi-threaded programs are used, then it's probably worth the premium as the extra 6 threads are worth a lot for those use cases.
However, if you are strictly building a gaming only machine, the 8400 represents better value IMO, and the savings there should go towards a faster GPU, which is the key for gaming systems. That $90 is enough to get you an upgrade from a 1070 to a 1070 Ti, for example, which further improves gaming performance by about ~20%.