I have messages on Discord regarding a "to do list" from years ago. It's not getting fixed anytime soon, I can assure you that. Lol.
I found a fix that worked for me. 1) Start the race like normal. 2) Restart the race as soon as the lights go out. I found by doing this the AI don’t stop every 5 laps for new wet tyres. However you must start the race dry, and then when it eventually rains they don’t have the issue. I don’t know why this is. I tried this on a few builds ago so not sure if this still is the case. You should try and see if you get the same results as me.
Or make sure the last session before the race also has rain and let it complete/finish. Then the AI should be alerted to the upcoming weather. But your solution seems a touch simpler. !