Not sure it's a bug.
1) Much of most caves are in darkness.
2) Usually the best spot for a door ends up being a tile labeled "surface of the earth" or something. This tile allows light over about the front 6 tiles of the cave or so.
3) Building a door limits the light that gets in to about 2 tiles. Dismantling the door does not reset the tile to "surface of the earth" if I recall.
4) You need to build floor/ceiling on the whole floor, then the whole area will be visible like inside a building.
What do I do now that I've built the door?
I Usually make a big fire and build as many floor/ceilings around the illuminated area while the fire "light" burns. You can also use torches to light up so you can start tasks.