It's largely down to NASA's "waterfall" development approach. Everything must be custom designed from the ground up, all things made sure to be correct and safe before the first bolt is installed.
That's why a lot of the "new space" oriented programs emphasize "commercial-off-the-shelf" solutions so much. They're only just barely catching on to the relatively obvious bit that costs can be reduced a lot by relying more heavily on existing commercial solutions. Space isn't the most extreme environment compared to what a lot of industrial gear has to be able to deal with.
Some examples which come to mind are the cameras which were used to record video of Perseverance's landing, as well as most of the Ingenuity copter itself, were COTS parts. IIRC as a result Ingenuity has more processing power on board than Perseverance's main computers. These were all low cost lower priority components, but they did a great job of showcasing the usability of COTS parts.
Careful, careful. The COTS part is a bit misleading as a great part of the total cost is in testing and certification. Some might be under the impression that JPL just took some COTS parts, stuck them on Ingenuity and that's that.
This is not the case. Of course every component had to be tested for space worthiness and possible interference with other systems. All that takes time, money, and specialised facilities.
It's also important to keep in mind that the helicopter was a technology demonstrator, a proof-of-concept that played no critical part in the overall mission. Its job was to perform one flight to show it can be done. It's a big difference if your components only need to do their job once, or if you have to have a guaranteed minimum endurance and the entire mission depends on them.
That's why a lot of the "new space" oriented programs emphasize "commercial-off-the-shelf" solutions so much. They're only just barely catching on to the relatively obvious bit that costs can be reduced a lot by relying more heavily on existing commercial solutions. Space isn't the most extreme environment compared to what a lot of industrial gear has to be able to deal with.
Some examples which come to mind are the cameras which were used to record video of Perseverance's landing, as well as most of the Ingenuity copter itself, were COTS parts. IIRC as a result Ingenuity has more processing power on board than Perseverance's main computers. These were all low cost lower priority components, but they did a great job of showcasing the usability of COTS parts.