“Why was there even a tech bubble, with stocks earning no profit trading at high prices? ”
Because the market efficiently reflected people’s beliefs that the price would continue to go up.
When those beliefs changed, the market reflected the change.
You don’t need smart people for an efficient market, only a market that allows the price to reflect their interpretation of the information available to them.