Could that be a use case for Docker?
Run official Joomla docker image in a specific version, and you can swap for another version for testing various environments
If a specific website is using the extensions, a snapshot of the website can be turned into a docker image
Docker image should have xdebug ready to go and be able to remote debug. Visual Studio ...