The issue is that the YouTube webpage video player itself tries to detect when it is backgrounded - seemingly via both APIs and usage patterns - and will stop playback when it detects that. This is true on desktops as well.
There were extensions to disable this behaviour that thankfully work with Firefox for Android.
There were extensions to disable this behaviour that thankfully work with Firefox for Android.