You could certainly for example, film ‘once upon a time in the west’ in a green room and overlay the actors upon a western themed cgi environment, and have it look believably realistic.
But are the actors going to act as if they were under the burning sun as believably ? Will they avoid looking at the sun ? Will they tend to seek the shadows ? Will they sweat ? Probably not, and the feeling you’ll get from the film will be different, without you being able to know why