This could be Strata by Terry Pratchett, written in 1981, before The Colour of Magic. Like the later Discworld novels, it takes place on a flat planet, although one of a science fiction, rather than fantasy, nature. Beneath the disc is an extensive mechanical architecture that keeps the whole thing running, including simulating both mundane and magical phenomena. There are fake sun, moon, stars, and planets orbiting around the disc; the characters also meet a muscular winged demon, who can only actually fly because an underground teleportation system automatically teleports him upward many times per second. If anyone tried to dig down into the underground mechanisms, the systems produce holograms of horrible monsters to drive the interlopers away. However, the whole system is running down.
On an island at the center of the disc, the main characters (the human Kin Arad and two other intelligent aliens) find that the disc was created by the very same godlike being who made the whole universe. The computer that largely runs the disc reveals that Kin Arad had been lured there by a human criminal who had previously located the disc and wanted to plunder its riches. He had been part of an early experiment in pre-FTL travel, placed on a ship in suspended animation until the ship got close enough to another planet to wake him up.