Last I heard the current record for transistor switching speed is around 600 GHz, so they aren't THAT far away from terahertz. EUV was a couple process generations away for probably 15 years before it finally happened (and laughably, it wasn't Intel who did it as they still haven't sold a single chip made using EUV) 450 mm wafers were also about two process generations away at that time, but that will never happen.
Just because we have 5 GHz CPUs doesn't mean that's the speed transistors are switching at. Modern CPUs have something like 20 FO4 delays per cycle which implies we've had transistors switching at at least 100 GHz in our modern CPUs. Likely well in excess of that as you have to account for wire delay as well as FO4 delay in your worst case clock network.
Intel could have reached 10 GHz in the P4 without TOO much trouble - they already had the integer pipeline half clocked and running at around what 3.8 GHz when they gave up on P4 I believe. I'm sure the plan was to expose the half clocked pipeline in future iterations, so that would make it a 7.6 GHz CPU. If they'd stuck with the P4 architecture a little longer they could have reached 10 GHz before long.
The problem is that each cycle would not have been accomplishing all that much so the pipeline would be REALLY long, which is bad for branch delay and filling load/store delay slots so IPC would be terrible. It was also consuming a lot of power, at the time when consumers cared more and more about power usage in laptops and minimizing fan noise in desktops.
Reaching 10 GHz in a CPU that was power hungry and inappropriate for laptops, and wouldn't perform any better than 2.5 GHz PPro/PIII/"Core" architecture - and AMD being competitive at that time as well - would make continued sale of the P4 based on marketing MHz a difficult proposition. That's why they decided to hide clock rates behind model numbers going forward, so they wouldn't have to explain to consumers why the CPU in the latest PCs was clocked a lot slower than the one in last year's PCs after spending 20 years teaching consumers that more MHz = more performance.