is_rtl returns false while it should return true

Case 1 – is_rtl() is not working because it has been called directly. To use such contditional tags in WordPress, query should already be run. So such function should be used inside the function hooked to appropriate hook. Since it is called directly, its value will be always false.

See https://developer.wordpress.org/themes/basics/conditional-tags/#where-to-use-conditional-tags

Case 2 – It is working because you can using this tag inside the function hooked to admin_footer. So, is_rtl() will give you appropriate value.

So, if admin_footer is not working for you then, you need to check which hook is appropriate for you and use is_rtl() inside the function hooked properly.