How did it know it had been detected?
The first instance of developing a crude RWR for snorkels was I think near the end of world war 2. German u-boats which had snorkels installed were also provided with a crude detection device, it was linked to a, I think some sort of light bulb, sensor which will glow more depending upon strength of a radar signal. Operators of that device were said to predict accurately about when their sub had been detected.
It will be surprising if Kilo is not equipped with some type of RWR when it is snorkelling or periscope out.
Lets not get into whether it was an Indian sub or not, useless debate. But if it was an Indian one, than our side had reasons to celebrate as well as send a message across.. an Indian kilo will have a range of about 600 km on battery power at best and that will result in a radius lower than 300 km. Being able to detect Indian subs snorkelling at 300+ km is big thing in tactical terms.