More than 3,000 homes and 100 miles of road along Scotland’s coast will be swallowed by the sea within decades, a study has warned.