This is a bad argument. Taxes are also money invested, in schooling, infrastructure, etc.
It's a very common fallacy of people criticizing public spending to point to the stock market and say "Look! Imagine how rich we would be if we had just invested the public spending instead." Completely falling into the trap of discarding the value growth of public investments just because they are not measured and advertised the same way.