Most DRAM is a commodity, yes. But Apple has an unusual memory architecture. Does commodity DRAM offer the ideal design to work with it? Or might Apple benefit from a customized in-house design—one optimized to integrate synergistically with that architecture? Perhaps a specialized variant of HBM memory, say, or maybe an entirely different design.
Sure, it would likely cost more for Apple to do this than to buy off-the-shelf RAM. But Apple, with its premium prices, has the flexibility to pay for premium components, if they provide a significant performance boost.
The "barrier to entry" into the market would only apply if Apple wanted to compete on price/performance in producing commodity RAM that it then planned to sell into the general market. But neither of those would apply to the RAM Apple would build for itself (it's not going to be commodity RAM, and they're not going to be competing for RAM sales, b/c they're not going to be supplying it to anyone but themselves).