Why do people climb Mount Everest? Why does Elon Musk want to go to Mars, instead of spending the rest of his life in an alcoholic haze, hip-deep in supermodels? Why do people enroll in West Point?
Some people want real adventure; the knowledge that they're in a holodeck would ruin the experience, no matter how interesting it was programmed to be.
People like to contribute, and to have value - that's why there are peons scrubbing Jefferey's tubes, and showing up to 3rd shift in the Astrometrics lab, even if they know that they personally won't be making some great discovery that Picard and Riker seem to every month.
> And also the ship blows up all the time like no one's business.
That's just factually wrong; while the Enterprise-D is in danger a lot, it's also at the frontier of Federation exploration, and the people on it know the risk. You can be a Federation officer and stay close to home.
Because he is in love.
This brings up another point that is never addressed. Quark runs a casino / bar / futuristic (adult) movie theater expressly for profit. It's also implied that Star Fleet members don't get paid because they are members of the federation. Yet these same officers are often seen frequenting Quark's place. Where did they get the latinum (money)?
For the episodes where they aren't dealing with extra-Federation societies like the Ferengi, it makes perfect sense to not talk about money on the ship. It's not much different than being in the Navy today: if you work on a US Navy ship, you don't have to pay to see the doctor, or to go to the mess hall and eat, etc. All that stuff is free. It's part of being a crewmember on a ship. It's the same on the Enterprise-D (or even Kirk's Enterprise), except they have even better benefits (e.g. replicators; on modern Navy ships there's I believe a little store where you can buy extra goodies they don't give away in the mess hall, but with replicators you wouldn't need this). Gene's idea of modeling Starfleet on the Navy worked out pretty well this way for a while, until they started dealing with jurisdictions outside of Federation control and then they had to retcon stuff like "gold-pressed latinum".
(Honestly, they totally hand-wave why you can't just replicate latinum)
On worlds still using money with which Starfleet interacts, the local administration could simply make an arrangement with the local purveyors of desired goods to cover their tabs, perhaps at least partly in trade. The needs and wants of the Starfleet crew members would likely be only social, such as hanging out at the local bar.
There would be temptation by the locals to pressure the crew-members to give them replicator-made goods, and by the local proprietors to lie about bar tabs, but its nothing our current system doesn't deal with.
Most of the adventure, if that's what this is about, is carried out by the executives at great risk to themselves. It seems that there is a huge crew of peons who just make the ship run. And also the ship blows up all the time like no one's business. From a realistic point of view the Star Trek universe seems insane.