Walmart, Target and Dollar General are among those investing in remodeling thousands of existing stores, even as shoppers take their dollars online.