Solving the initial conditions problem for modified gravity theories