How to bake a generated texture from displace modifier to UVs
I may be wrong but it looks like there's no automatic way to bake the height map of a Displace modifier.
If your object is flat with 3D relief, you can apply the Displace, give it a black and white gradient texture on the Z axis, plug it into an Emission, create a plane above and bake the Emit.
If it's a more complicated object, Ilakya gives here a method to do it, with the Multires and Shrinkwrap modifiers:

Create your model with its Displace modifier.
Create a second object that will contain the model as a sort of cage.
Give this second object a Multires modifier. Give it also a Shrinkwrap modifier, Wrap Method &gt; Project, with the model as Target. Hide the model.
Subdivide the Multires of the second object until it looks like the model. Lower down the Level Viewport down to 0.
Apply the Shrinkwrap modifier.
Give your object a material, create an Image Texture, keep it selected but don't plug it for the moment, create a new image for this Image Texture.
Go into the Render panel, choose Cycles. In the Bake panel enable Bake from Multires and Bake Type &gt; Displacement, click on Bake, it should work.