Or to put it another way, if you're adding core value to the business proposition or enabling their core business you're probably not going to be seen as a cost center. If you're R&D or innovation focused, probably not a cost center.
For example, working on a Wordpress site for a newspaper, probably cost center unless they're extremely tech focused. NYT comes to mind, but they straddle the line between saas product and not. They're selling the subscription service which puts you in product camp but they also have engineering functions that work on enabling their writers produce content. The content is the thing being sold, not your software so its probably some mixed feels over there.
I should probably extend the original "ecommerce or marketing" to any more traditionally non tech business model that has built itself as a tech company. For example:
Working on a website for an architecture firm = cost center.
Working on cad plugins for an architecture firm to use internally = probably not.
And again, caveats, even for ecommerce you could be considered a cost center if the business is more like a traditional brick and mortar but they've "started selling online".
Product companies: selling your software as a product means you're always going to feel like you're on an assembly line. Except you're not the assembly line worker, you're the assembly line.
Ecommerce and marketing companies: you build software that enables the company to sell some product. You're not the assembly line, you're not even working on the assembly line. You're designing the assembly line and building the machines. You're the engineer.
Whatever you do, always avoid companies that treat engineering like an IT cost center. The work culture is always dogshit and you're the first to go in a downturn. Look for somewhere that is "engineering first" or "developer driven" (e.g. somewhere a dev is high up on the org chart.)