With a little careful measurement and either some good tools or a lack of concern for aesthetics, you can make a pretty cool freestanding bookcase out of Ikea parts. The idea is that it’s standing on the ground but the poles are telescoping, allowing you to ratchet it up against the ceiling. Boom: instant, stable freestanding bookcase!
It’s probably a lot less likely to be knocked down than regular bookcases, although I wouldn’t let my kids sleep in it. The creator of this particular item didn’t like the look of the feet, so he replaced them with others, accounting for a fair piece of the time spent. If you’re not as picky you can probably get this done in a couple afternoons, but the cost is still going to be $400-$500.