The mood shifted in the 1970s. Military spending ebbed, and government expertise fell out of favor. Richard Nixon disbanded his science advisory council and encouraged private-sector entrepreneurship to fill the gap.

And in the 1980s, a new generation of technologists came into their own. The men and women who built companies like Apple and Atari still believed in technology. Place a computer on every desk and enable networked communication, they believed, and you could remedy society’s failures and injustices. But they often had radically different politics from the Republicans who led the Valley’s first high-tech wave. Vietnam and Watergate had shattered their faith government. Government was no longer tech’s most important patron and customer. Instead, it had become a symbol of things gone wrong, of stagflation and red tape.

The disdain was clear. “I’ve never voted for a presidential candidate,” Steve Jobs declared in 1984. “I’ve never voted in my whole life.” Charlie Sporck, head of National Semiconductor, was more blunt: “I was anti-government and viewed all politicians as a bunch of bastards.” When moguls like Mr. Jobs and Mr. Sporck went to Washington, they petitioned for tax cuts and deregulation, not the scientific investments of the previous era. Their comments reflected a broader antipathy toward government that is far more important to understanding Silicon Valley than libertarian economic thinking.

America’s leaders amplified and reinforced this message. “These entrepreneurs and their small enterprises are responsible for almost all the economic growth in the United States,” Ronald Reagan declared in 1988. “They are the prime movers of the technological revolution.”

Techno-optimism evolved alongside the two major parties. The small-government conservatives of tech felt ignored by George H.W. Bush and left behind as the national Republican Party embraced social conservatism. A new generation of Democratic lawmakers adopted high-tech priorities. Bill Clinton worked with Silicon Valley to shape internet policy and promoted closing “the digital divide” as a solution to economic inequity. Barack Obama sounded a similar note. “What a magnificent cathedral that all of you have helped to build,” he declared in a 2015 speech at a Stanford cybersecurity summit.

So when Facebook’s Mark Zuckerberg talks about “bringing the world closer together,” he is building on a decades-old belief system, supported by lawmakers of both parties, which holds that networked computers are tools of liberation (even if it’s not entirely clear who is being liberated from what) and that more connection, more transparency and more powerful technology will somehow “make the world a better place” (even if it’s not entirely clear what is better or for whom). When the most powerful tech companies seem to disregard politicians’ calls for reform, despite the threat of fines and antitrust action, they are following the lead of their heroes, who believed that the best thing that government could do for tech was to get out of the way.

And despite the bipartisan backlash in Congress against Big Tech, policymakers have not strayed far from their fundamental belief in techno-optimism. Politicians and policymakers look to the tech industry to power the economy — and perhaps even to “save” dying coal and manufacturing towns with coding boot camps and Amazon fulfillment centers. When Congress demands that social media companies find technical fixes for the proliferation of hate speech or election meddling, there is a subtext: The answer isn’t less technology; it’s different and better technology.