It's not an investment, but it doesn't
have to be an investment to be useful!
Instead of making money by choosing stocks, market makers make money by providing a concrete service to the market: they make it easier to buy and sell for people who are investing. They are more like the merchants or shipping companies of finance, rather than speculators. And there is nothing wrong with this!
In fact, calling it gambling is just wrong: most market makers actually take on very little risk! While their actions are not felt by the company directly, they are felt by people who own the stock and people who either want to buy or sell it. And knowing that it's easy to buy or sell a stock makes people more likely to participate in the markets, which is definitely a good thing.
Also, it's very important to note that even non-trivial investment strategies do not involve buying and holding on to large blobs of stock for months. Instead, you likely want to micro-manage your portfolio following some sort of mathematical model every day to minimize risk and exposure. Again, there is nothing wrong with this! But it does involve quite a bit of buying and selling stock, and the liquidity created by market makers really helps.
Viewing the stock market as solely a means to invest for long periods of time is really missing most of the picture. Your suggestion would actually increase most people's risk, leading to more gambling rather than less--or just significantly less investment over all!