This exact question was answered at my source: News: Ticker Messages June 2015 "Generally speaking, the prison was built by the original inhabitants of Roshamuul as part of their bargaining with demons. More clues are scattered throughout the city and its inhabitants, so keep your eyes open and you might figure out more - look, listen, read and learn. I think it is more rewarding to find additional clues in future updates that might shed a new light on old topics and prove some speculations right and others wrong." -answered by Knightmare, Tibia Game Content Design.
Added on 29/08/2021:
It was built by "Dreamers". It can be read in the following document- https://tibia.fandom.com/wiki/The_Dreamers_II_(Book)
"A short while ago, the council was approached with the request that we use the arts of our race to construct something entirely new: a prison made of dreams, using the veils and barriers of other worlds to dampen the power of all creatures, and lock them in and torture them for all eternity. We did not question this request. It was much too tempting to grow even more powerful, and so we consented. "