That presumes there would be ways to engineer around the problem, and not, as most representations (including the one TOADY JUST GAVE) of the magic system would have it, simply having a text box pop up informing you that your fortress crumbled for no good reason because you were stupid enough to have a library. Again, I point to the 2d game, where the game ended "unsatisfyingly" because you just have a percentage chance of instant game over with no chance to engineer around anything.
I would have to disagree that there isn't a way to do this. All the design here is a bit up in the air I admit, but I think it could look something like this and work pretty well:
Library is created and researching "terrible secrets" or something is enabled as it would be off by default. So Urist McMagescholar decides he's going to try and learn some new magic. He get the job "
PONDER THAT WHICH SHOULD NOT BE." The job can have a variety of outcomes, likely distributed along a curve just like item quality.
Great: Breakthrough, leading to increase in understanding and maybe a new ability or something.
Good: Skill gain, points added to pool that might lead to breakthrough
Neutral: Nothing happens.
Bad: Urist glimpses something bad get a strong negative thought.
Very Bad: Urist glimpses something really really bad, get a strong negative thought, and becomes incredibly incurious.
Even Worse: Urist goes instantly insane
Epic Failure: Urist goes instantly berserk
Getting interesting: Urist and everyone else in the library goes instantly berserk
Hilariously Bad: Everyone nearby gets a random syndrome
Catastrophic: Urist sees that which should not be. That which should not be sees Urist, likes what it sees, and comes to visit.
!!FUN!!: Urist becomes filled with joy and gets instant legendary skill in a new dance called "The Crimson Welcoming." He immediately goes to the tavern to lead the first and only performance of this unique and beautiful work of art...