I remember looking at prices for OEM parts for my motorcycle and marveling at how I could effectively build my own, but parts alone before shipping would cost me like $80k for a bike that was <$25k new for the several year newer model at the time.
The cost for the part at the factory for 1,000+ units is radically different than the part for your one off garage build.
There's a lot of logistics cost for replacement parts, shipping, storage, a system to track them, etc. in distribution warehouses all over the world in small numbers. It's all work done manually by humans at every level. Studies to project failure rates, failure modes, demand planning, etc. may be baked into this cost as well depending on how the company accounts for it.
Many years ago I was servicing Maserati GranTurismos and Quattroportes of which some use a ZF 6 speed auto transmission. Since the same transmission is used in Land Rovers, I would buy parts from the Land Rover dealer which was nearby. One time I went there and they didn't have any fluid for the transmission for Land Rovers, but they did for Jaguar. The fluid was identical, but on a different shelf, and cost a lot more. The parts department said that Jaguar uses a 3rd party parts distribution contract in North America, but Land Rover does it in house, so every Jaguar part, of which many are identical to Land Rovers, costs more. They could not just bill out a Land Rover part internally to their own dealer to service a Jaguar either (they were a franchise that repaired both).
The cost for the part at the factory for 1,000+ units is radically different than the part for your one off garage build.