A) Note that outside and above ground are two different things. Outside is the opposite of inside, and above ground is the opposite of subterranean. But since normally light and above ground
always coincide, and dark and subterranean also
always coincide (at least from my experience), it can be easy to get things confused. (Apologies if you already knew all this; just trying to cover everything.)
B) The light/dark flag definitely does need to be updated correctly, in the same way that the inside/outside tag already is. My guess is that Toady is waiting for when he does significant work on the fire/lighting arc to mess with light. Regardless, I believe the problem in your case is that the subterranean flag is what is relevant, and once a tile is above ground, it can never become subterranean again, and that
might be a perfectly legitimate game design.
C) My
For Each Tile Tweak module can turn large quantities of tiles into dark/subterranean tiles quickly. In your case, you might be able to get away with executing the following operation set with my utility:
Condition:
is_inside and not (is_dark and is_subterranean) and (x <= 5 or x >= map_width - 5 or y <= 5 or y >= map_height - 5)
Operations:
make_dark;
make_subterranean;
This will cause all tiles near the edge that are inside but not both dark and subterranean to become dark and subterranean.
Alternatively, you can use my program (and I believe Dtil and TileEdit can do this as well) to just alter the few individual tiles where you need to construct stuff. For my program, you'd simply set the condition to "at_cursor", and then loo(k) in the game and move the cursor to the tile you want to alter. With the operations set to "make_dark; make_subterranean", you'll set that single tile to be dark/subterranean. Move the cursor elsewhere, and execute the operation set again. Repeat as necessary.