Iran likely already has optical telescopes on high elevation overlooking the strait.
That optical telescope or sensors doesn’t tell you who the ship is. It tells you it’s a ship, maybe you can tell it’s a tanker if optics are strong enough, but not what kind of fuel it’s carrying or who operates it or where it came from.
Also the radar is used to guide the cruise missile or drone to the target until its seeker turns on. Unlike Ukraine, iran doesn’t have access to Starlink to solve this problem by just using optical drones to hit the target.
I still believe this isn’t due to a complete lack of Iranian detection capability and more due to a lack of Iranian will.