I note this is more of an outlier for pre-med than pre-law. A whole bunch of future highly-compensated attorneys are lurking around in all sorts of majors at highly selective colleges.
The difference, of course, is the pre-reqs for med school create an efficiency if you then also major in something where the pre-reqs count as classes toward your major. Your friend showed why that is not a hard rule, but it certainly becomes a reason for a high correlation between pre-meds and a certain set of majors.
But there are no pre-reqs for law school. So . . . anything goes.
Yeah, I started in one major, but explored another interest that kept developing. In junior year, I finally decided to switch from X to Y. There was actually an established X and Y major that would have worked best for my courses to that point, but I talked to people in the Y department about an interest in grad school, and they advised me to just switch entirely to Y and load up on Y classes.
So I did, and it all worked out.
Incidentally, stories like that are where actually attending a very good general college might really help. I don’t think this is limited to Ivy+, but because both the X and Y departments were pretty good, and the college in general was pretty good, I could switch late, still end up with departmental honors, still get great professor recommendations, and still get into top grad programs in Y.
I do wonder if that would have worked out if I had chosen, say, a college very good for X, but not so much for Y. Would a late switch have worked out as well? Maybe not, I’ll never know.
But still, this is one of the good reasons in my view to prefer a good general college. And as usual, generic rankings don’t capture this sort of thing well, including because they tend to want to reward good specialist schools.