Does refactoring have a cost besides time?
Solution 1:
No. You will not lose any resources that were used to construct the object you are tearing down. When you pick up an object off the ground, it returns to your inventory just like when you assembled it. Raw materials on transport belts, such as copper ore will also be placed into your inventory. In the case that your inventory is full, you will not be allowed to pick up anything until you make space.
Solution 2:
When you tear down structures you automatically pick up all items inside them. That means there are two things that can get lost:
The fuel item that is currently in use (e.g. in a furnace). So if you put 10 pieces of wood to a furnace, two have been completely used up and you see the progress bar for the third one, you will get seven pieces of wood back. No matter how full the progress bar is. If you do not want to lose any fuel, take out all of it and provide raw ores until the furnace shows the "out of fuel" symbol.
Liquids. All liquid ingredients and products are lost when a building is teared down. The same is true for pipes and storage tanks. It is hard to have no losses when refactoring this, but you can minimize them by using small pumps to at least empty pipes and tanks before removing them.
If you tear down an assembling machine / chemical plant you will also get back the ingredients for the item that is currently manufactured.
So in your case there should be no losses when refactoring.
Solution 3:
You may lose a handful of raw materials, depending on what structures you're taking down. For example, if a furnace has 1 coal and 1 iron ore inside of it, the coal will immediately be consumed and the iron ore will begin to smelt. If you retrieve the furnace while this is happening, you'll only get the ore back - the coal has already been "converted" and cannot be retrieved. However, any extra coal that hasn't been "converted" is still retrieved like any other raw materials. I believe it's similar for labs and other structures that use "fuel" types.
Other than this (very minor) loss, you should get all your materials back that are stored in whatever you are mining.