Yes, insurance covers repairs to make the the insured item - car, house, boat - the same as it was before. If this means complete replacement, that happens. If it means doing repairs, that happens - whichever is cheaper.
I had a friend whose garage sided onto a walkway between streets. Some little buggers lit a fire which consumed his garage and got into the rafters on the the side of the house (And melted the whole front of his new Hyundai SUV
). The insurance basically replaced the burnt few trusses, his garage, and then ripped out all the (heavily smoked) drywall, windows, siding, doors etc. and pretty much rebuilt the house - probably still cheaper than building a frame from scratch too.
In another case I know, the owners of a 3-story apartment had a tenant with a grease fire that got into the attic space and burnt a lot of the roof off. The market was in a down-turn and the owners were happy to take the money and demolish, but the insurance company said no, the roof and interior repairs would be cheaper than writing off and demolishing the building - so rebuild it was.
You insure for a basic amount - replacement and contents. Many people underinsure because they forget construction materials and costs are higher than, say, 15 years ago. You also need to insure for contents (or spend the next 6 months n your pyjamas); you would be surprised how much some of the contents - TVs, furniture, appliances, bedding and clothes, etc can add up to; also to cover hotel costs while waiting.
You also have to read policies carefully or have a good agent. In places where floods, earthquakes, or hurricanes are common, specific protection for those are usually an add-on to the basic coverage. I read about one city where they had a water main break - some people had a foot of water come into their yard and fill their basement, but the insurance called it “overland flooding” and without flood coverage, the owners were SOL. (Sewer backup is covered) The city had a bylaw saying they were not responsible for water main break damage. Owners, doubly SOL.
Policies for contents also often exclude certain special items - jewelry, fancy cameras, other expensive toys, expensive collectibles - you need special appraisal, and specific coverage for those items. As for very personal stuff like family albums - not much you can do except keep backups…
So - you get the coverage you pay for. Read carefully.