How make particle objects follow z axis while also following the ground?
The particle system uses the normals from the mesh to grow the 'hair'. So, if you want to make all the particles grow upright and follow the terrain, what you should do is:

Create another mesh above the terrain (as simple as possible, like a
plane, or circle)
Subdivide it a few times
Use a Shrinkwrap Modifier on the new mesh, so it follows the
terrain, at the same time preserves the normals pointing upwards
You may use Wrap Method as Nearest surface point and Above Surface, but you may try other methods if you like
Make the particle system on this new mesh; (on the modifiers list,
the Shrinkwrap must be above the particle system).

This way your grass will grow upwards, and the roots will follow the terrain.