And this does not include postdocs. CS is unusual that some people can go straight from grad school to professorship - I've seen it happen many times - but most sciences require at least one postdoc. I can't speak for engineering.
To generalize from a few anecdotes, the Humanities professors that "do" something can get their Association card in as little as 5 years. (e.g., notable book, visible research, department responsibilities...)
In other words, "20 years" is for a layabout?
At many/most well-known US research universities, a tenure-track position in Engineering (and possibly, Sciences too) is up for evaluation after six years from start of hire. The exact term may vary from institute to institute, but is six for most of the top universities. At that point, they either give you promotion (i.e., tenure) or a one-year notice (i.e., fire you).
Note that this is not "full" tenure, this is technically a promotion from Assistant to Associate Professor. However, it is still tenure, and you can keep the job for life. It doesn't have the prestige of a full tenure. Full tenure is likely to follow, if you keep similar pace, in 3-5 more years.
In summary, tenure can be had in as little as 6 years after completing PhD for professors in Engineering. But, those are probably the 6 hardest working years of their life. Makes the PhD almost feel like a cakewalk.