I love how some have decided that the ref accidentally signalled a foul, accidentally told the VAR he was chopping it off for a foul, accidentally told the Scotland players it was a foul but actually knew it was offside all the time is the sensible conclusion, whereas thinking he gave a foul and then it was changed to offside later in the game because VAR realised how bad it looked is somehow a crackpot theory.
The ref clearly chopped it off for a foul.