The setting reminds me of the Gormenghast Trilogy by Mervyn Peake, especially the city in Titus Alone.