Here is a Kotlin extension to get the correct position even if your group contains a TextView or any non-RadioButton.
fun RadioGroup.getCheckedRadioButtonPosition(): Int {
val radioButtonId = checkedRadioButtonId
return children.filter { it is RadioButton }
.mapIndexed { index: Int, view: View ->
index to view
}.firstOrNull {
it.second.id == radioButtonId
}?.first ?: -1
}