What? I was under the impression that they rely mostly on advertising to recoup costs, their advertising budgets are generally much larger than their R&D budgets.
Big pharma uses patents to protect their monopoly on a drug for seven(?) years after its introduced. Once that window is up, generics come in and take a huge chunk of sales. Pharma uses marketing and advertising to push their new drugs to try to sell as many during the patent window as they possibly can, when they have a large markup on it.
Their primary function, as you say, is shifting far towards the marketing end.
It's completely irrelevant what the size of their advertising budgets are. They will increase their advertising budget as long as they think that the added revenue will be larger than the added costs.
But if they have no patent protection, they will probably have no profitable product to advertise at all.
There are real advances too, and those wouldn't happen without some ability to generate a return on the $1B or more you spent on the drug (let alone the hundreds of millions on drugs that didn't make it).
R&D being a small part of the budget doesn't change that. The fundamental business is still based on the patent system.