The fact that marketing is a higher spend is irrelevant. It's like free2play on mobile. You spend a bunch of money developing something. If you can spend $.90 in user acquisition to earn back $1.00 then you throw every single dollar you can muster so long as the benefit is higher than the cost. It's a diminishing returns equation so you do as long as you can. The highest grossing games have marketing campaigns on the order of $100,000,000. Basically the same thing here. Take out as many loans as you can so long as it works.
For the vast majority of drugs the cost of producing the tablet you take is just a few cents, which is dwarfed by the amortized cost of the R&D. Nobody is going to spend on R&D if competitors can skip that part and go right to production.
The main structural problem is the blanket protection from the market that the people/govt offer to the pharma companies. Many shills continue to argue that this is necessary for pharma to make progress.
The problem is that this a quantitative question -- how much protection in $$ should pharma companies receive that would still not get in the way of real progress? -- is given a blanket non-quantitative answer by fiat. The answer is neither known for certain nor a constant of nature, it changes with time and situation. Any mechanism addressing this problem should have a fast feedback loop and pretty much the only scalable mechanism that we have for such feedback on economic affairs is the market.
Rather than subverting the market, one should actively involve it to create an efficient market where the people/govt and the pharma companies negotiate the level of protection that they can both agree on.
Patents are a mechanism that largely nukes this negotiation completely in favor of the pharma companies.
A parting thought borrowed from Upton Sinclair : if the justification for patent protection is high dev costs, it only ensures that the dev costs will be kept high to enjoy the (dis-proportionate) protection.