It also depends on the specific airlines. For your Bangkok - Tokyo - Frankfurt example, if both flights are ANA, they will let you check in for both flights at the first airport so you don't need to leave Narita. But that is their own policy rather than a universal rule. (I think JAL allows this as well but not completely sure).