How to check a stack of mobs the player is riding?

I need to be able to tell every layer of mob a player is riding for my datapack. I can easily do this via RootVehicle.Entity.Passengers, but the issue comes when there are multiple things riding one entity; e.g. 2 striders in one boat, or one pig and one player in a boat. I cannot tell whether the player is riding said pig, or directly in the boat. If this is impossible, that's that, but I would very much like to have it, because my datapack would feel pretty clunky in some exact situations otherwise.
Continue to help post