You ride one of these? Mine's still going quite strong after pivot servicing this year and a new rear derailleur late last year after those parts just wore out after many years of service.
Building up a new one gets up there.
A couple years ago, I built up a SS commuter with a pretty inexpensive frameset and budget parts most of the way around. I did get nicer wheels - spent about $450 there. Total build cost was about $1600 for a fully rigid 4130 CrMo steel SS road bike. I am upgrading the frame on that now and turning it into a 1x10. Retail on the upgrades would probably be about another $600-$800. Thankfully I took a shop job over the summer to fund my bike habit. When the upgrades are done, I'll be in this bike for at or just about $2,000. Still steel. That kind of dough could get me a full carbon 105 road bike if that was what I wanted.
Talking about a mtb, you could do a budget "custom" build and stay around $1,000 if you bought used parts and stayed as simple as you could (hardtail, maybe fully rigid, maybe singlespeed). If you want a full suspension bike, you're going to be looking at close to $1,000 and up for a frame and rear shock worth a custom build. Maybe as low as $600-$800 if you weren't picky and shopped closeouts and discount brands with cheaper frames.
But I find a pretty nice sweet spot in wheel quality around $500. Not the best stuff, but still pretty good. Probably looking at $500-$1000 for something like an SLX drivetrain. Maybe as low as $100-$150 if you saved some bucks and went with a BB7 brakeset, but probably at least twice that if you wanted some nicer hydros.
Then you've got the smaller bits and pieces like saddle, seatpost, stem, bars, headset, tires, and cables. Those things can add up, but you can bargain hunt here, too.
If you're building up a frame, you can't forget that there's going to be some shop labor involved unless you've got a FULL shop and all the tools at your disposal, along with the skill to use them properly. At minimum, you'll need to have a shop do frame prep for you (facing and reaming head tube and bb, facing disc tabs) unless you spend more on the frame and get one from a company that ships the frame already prepped. Possibly headset install, bb install. Possibly cutting your fork's steerer tube, setting the crown race, and setting the star nut. Possibly even doing the whole build or redoing the build after you've started and got stuck/messed something up (any shop mech will be able to cite examples of this happening).
I enjoy the process. It can teach you a lot about bikes, but if you're not experienced with the process yet, you should SERIOUSLY take your time to avoid messing something up. And especially take your time to make sure you're buying the correct components from the beginning. There are a lot of competing standards on bottom brackets, headsets, axles, and seat posts and a handful of little things to pay attention to (like front derailleur cable routing/cable pull).
And finally (but not least), you've gotta pay attention to fit issues. Chances are, you'll have to mess around with fit through stems, handlebars, saddles, and stuff once you get the other components installed. I did on my commute bike build and since I'm changing it up, I'm going to have to go through that process again.