Accessing z values for annotations in histogram2d mode

I recently switched from heatmap to histogram2d. I did this because while heatmap requires me to calculate the z values beyond plotly, histogram2d does it within.
The problem is that annotating the plot with the z values in heatmap (see last example) was easy. In histogram2d, I am stuck achieving the same.
I basically need to display the z value per cell. I can calculate before hand and annotate it, but I was wondering if there is a smarter way since plotly is doing all the heavy lifting for me anyways.
Any ideas?

Here’s a hacky way to access those z values: