I hope you saw Llando Norris interview after the race.
He said that for him it was perfectly clear that they could exceed the track limits at T4 exit but they were not allowed to gain an advantage.
Llando himself yielded a potential pass earlier in the same spot.
The Stewards made a very clear direction that in qualifying they would be very strict but in the race more lenient so long as an advantage wasn't gained.
This is not unheard of. I have been in races where the same thing was announced (Donnington MX5 Supercup 2020).
In qualifying the drivers have 2 hot laps per session. Low fuel, perfect tyres and are on the limit. If they exceed T4 limits it's to gain the 2 tenths. Especially with Q pace so close amongst top 15.
In the race with high fuel loads, worn tyres, heat of battle, dirty air it's harder for drivers to strictly observe that limit and harder for stewards to watch out for it. So the call was made to all the teams that it would not be so strictly enforced.
Cue Red Bull complaint about Hamilton and the Stewards got a bit stricter and he had to watch his line more.
Hamilton defended very well on his worn tyres. He has done it before here vs Rosberg.
It resulted in Verstappen having to complete his overtake with all 4 wheels off the racing surface at the very corner his team had cried foul on Hamilton. This was clearly gaining an advantage. His line was a product of his entry speed, had he planned to follow the rules his own team had reminded the stewards about he would have had to be slower. His total off-track excursion was a part of his overtake.
Therefore he gained an advantage (like leading the race vs running in 2nd place). The outcome of the move was the definition of gaining advantage.
So while it may be an emotional moment for Verstappen fans it was in my view a totally reasonable outcome.
Whether by waiting and using his shot later in the lap at say the DRS zone at exit of T10 or the pit straight he would have succeeded we will never know.
It was great racing though.
Here is Llando