As noted, at the beginning of TNG the holodecks were a new accessory for Starfleet vessels. The Galaxy Class being among the largest vessels at the time of TNG had 16 holodecks. I would assume that holodecks were installed depending on the tour lengths the vessel was expected to perform and the size of the crew. The Enterprise D and Voyager both were going to have extended tours, being away from spacedock for extended periods, from months to whole years, and would need to have sufficient recreational outlets on board.
Where as the Defiant and Equinox, which did not have holodecks, were both short tour vessels. The Defiant rarely going on missions longer than a month or two and being based out of a starbase, or attached to a fleet that would provide extended support. And the Equinox which was designed for short term, planetary research, probably to be based out of a starbase or attached to a fleet where they would provide a non-combat support role.
Another factor in determining whether a ship would have a holodeck on board would be power availability. Holodecks are very power intensive systems, as seen in episodes where the holodeck won't disengage and the power drain puts the ship in jeopardy. Only vessels with powerful generative capabilities would be able to afford the power required to run one regularly.