If my understanding is correct, you expect that one application gateway hosting 3 custom domain websites, then each of custom domain websites point to a specific webapp site.
Firstly, you could map your custom domain DNS name to Azure web apps. And bind SSL certificate for each site. Here is a tutorial. After that, You will find your Azure webapp sites DNS name change to the custom domain. You can access the Azure web apps directly through custom domain DNS name.
For application gateway multiple site hosting, you can set 3 backend pools. Each website can be directed to its own backend pool. The application gateway is serving traffic for test.mydomain.com
development.mydomain.com
preprod.mydomain.com
from 3 backend pools, let's say testPool, devPool, PrePool. Meanwhile, you can add 3 backend listeners, 3 routing rules, 3 HTTP settings and health probes.
It's recommended to configure these things following the PowerShell scripts from this wonderful blog and just ignore the part of Azure Active Directory Authentication.
Once you enable the health probe. You can check the backend health of the Application Gateway. The backend pool should be marked as “Healthy”. If not, then your app is returning a response outside of your probe’s range.
For more details, please refer to this tutorial: Create an application gateway that hosts multiple web sites using the Azure CLI