Perhaps it's not a huge mistake, but I definitely did not think through the pros and cons of getting a PhD. There have certainly been some benefits (e.g. being able to move from my home country to one I prefer), but the amount of forgone earnings and time working on problems all by myself (where I don't get the advantage of mentorship so much; profs really have checked out on coding since before y2k in the most part) is something I hadn't considered, especially considering how well situated I was having gone to a top school in the bay area for undergrad.
The advice I've learned and that I hope someone could use is this:
only do a PhD if you can't NOT do a PhD, or if you know some specific job that needs it.
Unless your curiosity and desires line up with a great research group, you put yourself in precarious situations, e.g. it's easy to just bounce from one crappy job to another, but trying to go from one advisor to another (especially at a different institution) is incredibly difficult and usually looked upon with suspicion (e.g. whether the original prof is unloading a crappy student).
Don't do a PhD for some external recognition, because it probably won't come unless you are near the top end of consistently top-tier publications every year (e.g. those mad men and women who publish multiple papers at OSDI / SOSP in a given year!). Far more likely you'll find yourself toiling on something to appease your advisor, and in those cases the end result is very underwhelming. Some institutions literally just ask you to hand in your office keys when you turn in your thesis to get your diploma and basically say "thanks for the years have a nice life!".