Before the 2017 change you could and should have if they were not engaged in actual R&D. But people used to lump them into R&D anyway because of the preferential tax treatment (you also used to get special treatment for NOL, which you can't any more).
Software development doesn't generally follow GAAP's model because unless you're IBM or Oracle the same people sometimes fix bugs and sometimes develop new features.
The GAAP rules aren't insane: if your company buys a HQ building it's assumed to last 40 years. And since each year you "get some value" (e.g. you don't pay rent to someone else) you split the value of that purchase over 40 years. If you buy a computer you amortize it over 3 years because you're likely to "use it up" and replace it after that.
And so if you're a car mfr you might have some people developing a new automatic transmission. You expect to then put those things into new cars for some time to come. So GAAP says the R&D that went into the new transmission is amortized while the cost of making one and sticking it into a car you sell is indeed COGS.
If you're an early stage pharma startup almost all you do is R&D for quite a long time. For a software startup you can say the same thing: even if you ship your MVP, every bug you fix is turning it into the "real thing" (unlike Oracle, above, who can split maintenance and development into two buckets).
So I favor accelerated recognition of R&D costs for startups. Not sure about established companies.