I believe each core is going at the speed of whatever frequency is, and applications/tasks use certain amount of the cores and the computer will be slowed down if there's too many tasks/things so it can take care of all of them

The i5-8600K is an 8th-generation Core i5 CPU. It has 6 physical cores, but doesn't use HyperThreading, so it's called a 6C/6T CPU (that means it can handle up to 6 threads, with each thread handled by its own core). Base clock is 3.6GHz, & is unlocked so you can OC it with the proper motherboard & a good CPU cooler (although I've seen from some of the Coffee Lake reviews that the Coffee Lake CPUs are harder to keep cool because of the higher physical core counts). If you don't OC, but can keep it cool enough, you can get up to 4.1GHz with 5 or 6 cores, 4.2GHz with 2 to 4 cores, or 4.3GHz if only using 1 core. For most multi-threaded applications, however (especially gaming), you're going to be looking at topping out at 4.1-4.2GHz unless you OC. Also note that, because it's a "K" processor, it doesn't come with a CPU cooler, so you have to buy one to use it even if you don't OC.

The i7-7700 is a 7th-generation Core i7. It only has 4 physical cores, but it uses Intel's HyperThreading technology to essentially split each core's resources so that they can handle 2 threads each, so it's called a 4C/8T CPU. It's not unlocked, so you won't be able to OC it; however, that not only makes the CPU less expensive, as well as not losing any functionality by going with a cheaper motherboard chipset, but it also comes with its own CPU cooler. The speeds are roughly comparable to the i5-8600K (3.6GHz base, 4.0GHz Turbo with 4 cores, 4.1Ghz with 2 or 3 cores, 4.2GHz with 1 core), so it comes down to whether the 6 physical cores can perform better than 8 HyperThreaded virtual cores.

At least when it comes to gaming, we're just now getting to the point where you can consistently expect CPUs with more than 4 cores/threads to perform better in games than 4C/4T CPUs...& from what it looks like, a 6C/6T CPU isn't going to have much of an edge over a 4C/8T CPU unless you OC it. Price-wise, they're within $20USD of each other (https://pcpartpicker.com/products/cpu/#f=85,75&s=12,13&sort=price&page=1), with the slight edge on the i5-8600K. However, that's offset by the difference in price currently between the cheapest H270 boards for the i7-7700 & the cheapest Z370 boards for the i5-8600K (https://pcpartpicker.com/products/motherboard/#f=2&c=121,119,128&sort=price&page=1), currently about $30 USD. And it also doesn't include the $20-50 USD you'll spend on a CPU cooler for the i5. And from what I can tell on the chipset features, there's not a whole lot of difference between the Z270 & Z370 chipset specs (same #/types of USB ports, SATA ports, SATAe ports, M.2 slots, PCIe 3.0 lanes, etc.), & not much difference between H270 & Z370 (H270 drops 4 PCIe 3.0 lanes, 1 SATAe port, 1 M.2 slot, & 2 USB3.0 ports, but still has the same # of total USB ports & SATA ports), & all 3 chipsets support Intel Optane.

Bottom line, it probably comes down to personal preference. Going with the Kaby Lake i7-7700 means you're going to be limited in your ability to put a better CPU into the system in the future, but chances are by the time you wanted to replace the CPU in the Coffee Lake system Intel will have also moved on to a new socket (or changed the pin assignment in the socket so it won't be compatible anyway).