Just remember that "its" (no apostrophe) is the possessive adjective in the same way as "his" is. So in the same was as you would obviously not write "hi's books", so you would not write "it's treasures".
IMO it is one of those daft exceptions of which there are many that they put in to confuse, and allow those in the know feel superior. Apostrophes could be simple (with a few exceptions) but for all this sort of unnecessary complication. If something belongs to it then the punctuation should be consistent as when something belongs to John, but of course it isn't. It wouldn't be funny otherwise.
In the terms mentioned in this question the words you mention function as possessive adjectives, tilly. They describe the noun with which they are associated (its treasures).
They become possessive pronouns if they are used alone to replace a noun. (e.g. The books belonged to maisie. They were all hers).
O.K. so......... The library burned down with all the library's treasures. Doesn't 'its' replace 'the library's'? Isn't that a pronoun? Standing in for a noun?
This is a genuine query. I stand to be corrected as I have obviously misunderstood this.
In the phrase you provide (“The library burned down with all the library's treasures.) I would suggest that “the library’s” is an adjectival phrase - that is a collection of words that act as an adjective to describe the noun. So, “the library’s” describes the “treasures”. If you replace “the library’s” with “its” (whilst keeping in “treasures”) then “its” is a possessive adjective. It describes the noun (treasures) by means of possession. You are not replacing a noun (as “treasures” is still present in the sentence) but replacing an adjectival phrase with a possessive adjective.
Adjectival phrases are quite common, though not so much in the phrase above. A more common example would be in a sentence like “…a lake is full of fish”. The noun “lake” is described by the phrase “full of fish”.
Hope this helps (but I think we're straying a bit from the question !!!)