yea i think it is when and where they first appeared. that is who owns the rights. scarlet witch first appeared in the brotherhood, which is from x-men. so fox has dibs. regardless of her being more associated with avengers, here origins are in the x-men, which fox owns.
That's not a bad assumption but quite a few characters have made their debuts in other comics. If I'm not mistaken both Black Panther and The inhumans made their first appearence in the F4 and Nova in Spiderman and yet Fox and Sony does not own the rites to them characters. Very dabatable between Marvel vs whatever studio on who owns the rites to a character. I would more then assume that Marvel would have not been so blind as to allow such an upcoming diaster and legal battle to take place in the future if they weren't more specific on how the rites of their characters were given.
It just makes sense for marvel to cover their @sses and be more clear on how the rites are sold to the film studio. Can you imagine if they weren't? I'm almost certain their would've been various legal battles on the rites to comic characters because said character first appeared in a property the studio has the rites to.