When I tried to set theme attribute to TextInputLayout, the theme was also getting applied to its child view edittext, which I didn't wanted.
So the solution which worked for me was to add a custom style to the "app:hintTextAppearance" property of the TextInputLayout.
In styles.xml add the following style:
<style name="TextInputLayoutTextAppearance" parent="TextAppearance.AppCompat">
<item name="android:textColor">@color/text_color</item>
<item name="android:textSize">@dimen/text_size_12</item>
</style>
And apply this style to the "app:hintTextAppearance" property of the TextInputLayout as below:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/mobile_num_til"
android:layout_width="0dp"
android:layout_height="@dimen/dim_56"
app:layout_constraintStart_toStartOf="@id/title_tv"
app:layout_constraintEnd_toEndOf="@id/title_tv"
app:layout_constraintTop_toBottomOf="@id/sub_title_tv"
android:layout_marginTop="@dimen/dim_30"
android:padding="@dimen/dim_8"
app:hintTextAppearance="@style/TextInputLayoutTextAppearance"
android:background="@drawable/rect_round_corner_grey_outline">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/mobile_num_et"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/mobile_number"
android:gravity="center_vertical"
android:background="@android:color/transparent"/>
</com.google.android.material.textfield.TextInputLayout>