Every part of a Bike has a Price , the Frame has a Name on it , every thing else is sourced from other suppliers ..
and those suppliers have multiple levels of the parts ,, derailleurs just one example ..
a couple high end parts are costing what a whole bike with serviceable, adequate for purpose, parts on it cost.
...