Probing the cosmic-ray pressure in the Virgo Cluster and the origin of the very-high-energy gamma rays of M87 with H.E.S.S. and CTA