What it's supposed to do is stuff that's valuable to humanity, but costs a lot of money and isn't expected to make a profit. This is essentially the role of any government organization: Do the things that will benefit everyone, but that businesses are unwilling to take on because there isn't enough money in it.
That may be true of the former Soviet Union and some modern European countries, but but the United States government was established to "form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity..." What you said may be A role, but its not a major role and certainly not "essential".
Thus spake the master programmer: "After three days without programming, life becomes meaningless." -- Geoffrey James, "The Tao of Programming"