Every other instance of "d20 roll" in the rules exclusively refers to the die itself, before modifiers. This case would follow that precedent
This answer argues for the rules as strictly written. The answer I believe to be correct both as intended and for its application is Ryan Thompson's answer, which I've accepted.
There are other abilities that use this same wording for example the Conquest Paladin's Invincible Conqueror Feature, which states:
Your melee weapon attacks score a critical hit on a roll of 19 or 20 on the d20.
The Paladin's feature does not suddenly make it so that if your roll after modifiers is 19 or 20 you get a critical hit. It exclusively applies to the d20 itself, before modifiers.
Another feature with the similar wording is the Rogue's Reliable Talent, which states:
Whenever you make an ability check that lets you add your proficiency bonus, you can treat a d20 roll of 9 or lower as a 10.
Every instance of the phrase "d20 roll" used throughout the books refers exclusively to the die itself and not the total of the roll after modifiers.
Because temple of the gods uses this same wording it also applies only to the d20, before modifiers:
Whenever it makes an attack roll, an ability check, or a saving throw inside the temple, it must roll a d4 and subtract the number rolled from the d20 roll.
If temple of the gods were meant to be applied as a modifier to the d20 roll, they would have used different language, as they do with the Barbarian's Indomitable Might feature:
If your total for a Strength check is less than your Strength score, you can use that score in place of the total.
This feature replaces the total of your roll (after modifiers) and not the actual d20 roll.
Another feature that modifies the result/total after modifiers and not the actual d20 roll is the bane spell. The Q/A "Interaction between Bane and critical hits?" states that bane does not modify a critical hit, as its description states:
Whenever a target that fails this saving throw makes an attack roll or a saving throw before the spell ends, the target must roll a d4 and subtract the number rolled from the attack roll or saving throw.
The spell specifically says that you subtract the d4 from the attack roll or saving throw, not from the d20 used in making the attack roll or saving throw.
This is supported by the section on "Saving Throws" and the section on "Attack Rolls" which state:
To make a saving throw, roll a d20 and add the appropriate ability modifier.
To make an attack roll, roll a d20 and add the appropriate modifiers.
A saving throw or attack roll is the entire result/total of the d20 and its modifiers while the d20 roll is the result of the die itself.
Features which modify your roll as a modifier do not use the same wording as temple of the gods while features that modify your roll before modifiers do use the same wording as temple of the gods, thus temple of the gods modifies the actual die before modifiers. It specifically subtracts from the d20 roll, not from the result/total of an attack roll or ability check.
But does this negate a critical hit? The section on "Rolling 1 or 20" states:
If the d20 roll for an attack is a 20, the attack hits regardless of any modifiers or the target's AC.
Temple of the gods subtracts from the d20 roll directly, which means that the d20's roll itself is no longer a 20. And if the d20's roll is not a 20 then it does not automatically hit. Thus it is no longer an automatic hit.
The temple of the gods spell turns critical hits into regular hits (or even misses) because it changes the actual d20 roll which the rules exclusively use to refer to the result of the die before modifiers are applies.