Testing for redstone dust in a certain area
My best idea is to summon 169 (13 x 13) armor stands, one on each block (you probably want to name them something too). Then you would run a command such as:
/execute @e[type=ArmorStand,name=SOMENAMEHERE] ~ ~ ~ detect ~ ~ ~ redstone_dust 0 /setblock ~ ~-1 ~ planks
Or if 169 armor stands causes too much lag, you could decrease the amount of armor stands by only summoning one armor stand for every 2 blocks, running the execute command, teleporting all the armor stands 1 block forward, and running the command again. Note that this method will take 2 ticks to run whereas the first can do everything in 1 tick.