Hello, I think the reason you qualified on the Medium tyre is because you set your advanced strategy to mediums after 1/2 laps.
For more re-assurance, I recommend that you have a look at the Advanced Strategy guide (Advanced Strategy in a Nutshell) which will help you to avoid this issue again and maybe give you a more definitive answer to your query.
"Basically, when track is wet and the AS is enabled, the simulator will choose the first AS option tyre if the water level is above Xmm, or the main tyre if the water level is below Xmm. The second AS option tyre is used when there is water in track and it is not raining."