I had this issue with ViewPager on API 28 because of ViewPager.setRotatingY(180) so that i can support RTL, I've tried replacing rotation with layoutDirection="locale", but it didn't work. I found a library for supporting RTL ViewPager here's a link https://github.com/duolingo/rtl-viewpager.
Add it to dependencies and just make sure you add layoutDirection="locale" to the RtlViewPager
<com.duolingo.open.rtlviewpager.RtlViewPager
android:layoutDirection="locale"
android:keepScreenOn="true"
android:id="@+id/quranViewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
/>
Update
ViewPager2 is locale friendly so it's automatically will change swipe direction according to the current device locale.
Some helpful links on the implementation of ViewPager2:
Android docs
Sample