Stochastic quantization of a self-interacting nonminimal scalar field in semiclassical gravity