Great question. I think there are really two points to target in your question. Maintaining someone's interest is a bit different than piquing someone's interest in primary care.
For those who are already interested to begin with, I think it's important to first remind them of why they were interested in the first place. Ask them what they had envisioned primary care to be. I'd venture to say that a good number of students wanting to be a "doctor" had envisioned a one-on-one, intimate doctor-patient relationship at the beginning of their medical careers, one that really sits well within a primary care setting. Secondly, it might be necessary to counteract this hidden curriculum that you mention. One of the underestimated pieces to the so-called hidden curriculum is that it is encountered so often in the students' day to day life. Their lectures are taught by specialists, their lunchtime interest group seminars are led by older students who are interested in subspecialities. Oftentimes, the initial interest in primary care is simply just overshadowed and shut out. Just maintaining or in the case of Stanford, introducing, a constant presence amidst all of these other opportunities can provide students with an equal opportunity to explore this field.
For those who may not have considered primary care before, it's important to give them a realistic picture of what practicing within a primary care setting is like. Oftentimes, I think misconceptions and stereotypes can cloud somebody's understanding, drawing them away from something they don't truly understand. Increasing the student exposure to different types of primary care practices or different models of health care delivery, introducing them to the research aspect that is present within primary care, tying the primary care practice with issues of health policy and wider spread systems issues -- these can all bring students interested in other fields (public health, health policy, health management and business) together.
I know that my response is not the answer, but from someone who has had to face this issue, those are my first thoughts. Thanks for bringing up this important question - I know that many chapters of PCP are facing this same challenge!