So if Silva had scored, would the goal have been disallowed for Havertz being offside?
No.
Offside players only affect goals if they’re interfering with play. Havertz is behind Silva and couldn’t be reasonably described as affecting play if Silva’s shot goes in, but he’s still offside so he can’t touch it until an opposition player has deliberately played it.