Games that build their own dungeons don’t just throw a bunch of rooms together. This Gamasutra post by Starlight Academy developer Adonaac (featuring animations by TinyKeep developer Phi Dinh) explains one way that a game can not just procedurally-generate rooms, but more importantly, have it actually work.
The short version: it’s magic. The longer version: it takes more than just code that builds rooms, because those rooms need to link together properly and be the right kind of shape for the game that they’ve been made for.
If you want to see Dinh’s dark sorcery at work, he’s built this demo which builds a new dungeon every time you hit F5.