Experience and reputation play a big part in this too. As your colleagues branch off to other opportunities they’ll bring your name up when the new company is looking to fill a role. At this point you’re being contacted by VP’s or Directors to gauge your interest.
Whether it's very top-level salaries or not (or necessarily developers), lots of people take good opportunities in at least somewhat less expensive areas that are very much in keeping with their interests and that are perfectly in keeping with their goals.