There is still a bug that will throw an exception if you simply replace fragment for <androidx.fragment.app.FragmentContainerView>. The fix, as of now, as stated by many google engineers in this bug thread is to change your code in your activity:
val navHostFragment = supportFragmentManager.findFragmentById(R.id.my_nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController