I'm going to be slightly contrarian here, and put choosing a quality upper at the top of the list, or at least the first part I'd start considering. Everything said above about importance of barrel, bolt, optic, etc is right on the money, so no disagreement with all that. But the importance of a good upper is often overlooked.
A cheap, loose, wonky upper can cause all those other parts to be out of alignment/concentricity in various ways. There are methods to tune up a loose/junk upper, but the higher quality you start out with, the less you'll have to worry about. A common problem with cheap uppers is the face of the threading, where the flange of the barrel mates against the upper - if that's not machined with precision, it won't be a flat surface, or squared to the bore axis of the upper. That can cause the barrel to sit in the upper wonky, and without fully mating up against that face. That's two different issues, both of which can cause accuracy and precision problems. Again, there are methods to correct this, but fewer of these problems arise with a quality upper.
Another common but little-recognized issue with cheap uppers is at the alignment-pin notch on top front of the threads of the upper, where the barrel's alignment pin goes in. If that's got some slop in it, you can end up with your barrel/extension clocked a little - I've seen that be bad enough to where the bolt lugs peen the lugs of the extension and even simply not lock up or go into battery. You can shim that pin and notch, but it's absolutely unnecessary to worry about if the notch is tight to begin with, and machined top dead center. Pin slop and a clocked barrel can also lead to multiple reliability problems. On a clocked barrel, if the gas block is properly centered on the gas port it means the gas tube will not fit properly into the upper, including being out of alignment enough to have the gas key on the BCG slamming into it, leading to failures to go fully into battery, and harmonics issues with accuracy. If the gas block is aligned TDC on a clocked barrel, then that gas port will be somewhat occluded by the gas block, resulting in insufficient gas to cycle the action properly, or just weakly, with mystery failures to eject and failures to chamber occurring.
All that can and does happen from a sloppy alignment-pin notch. And it gets worse with the tolerance stacking that can occur with alignment pins or barrel extensions being even slightly out of spec, and gas ports being improperly drilled.
This is a big part of what you're paying for with expensive, high quality parts - precision that minimizes all these little problems that bug cheaper builds so often.