Do solar systems have to evolve in a galaxy?
Probably not. You'd need a could of gas dense enough to contract under its own gravity. In the space between galaxies, matter is spread too thin for a solar-system sized cloud to exist. A much larger cloud could be more diffuse and still collapse, but being much larger, it would collapse into a galaxy.

Even within a galaxy, stars seem to form when shock waves from nova or some other event initiates the gravitational collapse.