I found the time to fix the issue. While doing so, I noticed that Waze added programmatic events for when the Street View marker gets dragged and when the Street View window is displayed, which allowed me to completely rewrite the script using just the SDK. This should mean that this script will continue to work no matter which changes Waze does (as long as the SDK remains stable, which it should).
One thing I couldn’t port over to the SDK was putting the layer checkbox in the “Roads” layers group. The checkbox is now located under the default “Userscripts” section. This looks like an acceptable trade-off to me.