Decentralised stablecoins, such as Dai, do exist, and the price of Dai does manage to maintain its peg pretty well. Not all decentralised stablecoins have done as well (most notably TerraUSD) though, it's definitely hard to design an algorithmic stablecoin that maintains its peg.