As long as the same is held true about car designs that never went to production, drug design that were not deemed profitable etc. Why pick on just software?
Yes, clearly the same reasoning applies to any copyright, patent, or trade secret (and we should stretch out the depreciation schedule to match the durations of those things. It follows that development of trade secrets would not be deductible. Perhaps a new category of escrowed expiring trade secrets could be created to make it deductible). We could all benefit from companies publishing research that didn't pan out, and it should come at little to no cost to them!
As much as I like this Utopia, this will unfortunately never happen in a capitalistic country.