Another thing is that in Sword and Shield in the Wild Areas, you aren't allowed to catch Pokemon higher than a certain level if you don't have enough badges. The dialogue mentions that the Pokemon "won't let its guard down" in a case like that.
Effectively, even if you do have what it takes to catch a Pokemon, at full health and no status it's harder to catch because its guard is still up and it's on the defense.
It's also worth noting that some legendaries since Gen 5 have been mandatory captures, such as Reshiram/Zekrom in BW1, which just before you battle them, N notes that they are saying "I want to battle with you. Try and make me your friend and ally." Essentially, the Pokemon is testing you, but wishes to join you as well in a case like that. Even in later cases like SM and SwSh, it's noted that the legendary wishes to join you, like in SM where Nebby wants to continue being in Alola and battle alongside you as its Trainer, or SwSh where the wolf of choice is implied to be testing you, and the other one Hop gets also asks to join Hop. Same with Calyrex, except this time it can literally speak and literally tells you that if you can catch it at its full power, it will be willing to join you on your journey.
In those cases, those are a case where the Pokemon is really testing your worth as a Trainer. It can be implied with other Legendaries in general, but the mandatory capture ones since BW1 really emphasize that idea.
While I like this idea, there is something quite sus in proving your affection by paralyzing and beating a living being to the brink of passing out, and then flinging mechanical balls at them until they give up their will to be free.
It's not necessarily proving "affection", per se, but rather proving you are worthy enough of commanding the Pokemon, and strong enough to be a trustworthy friend and Trainer. By showing your skill in combat and weakening it, possibly paralyzing it or putting it to sleep, you prove enough worthiness to the point where the Pokemon will let its guard down and be willing to be caught and join you on your journey. It's a showcase of strength, and many Pokemon may not be willing to join a weak Trainer or in the case of fainting, one who is too ruthless.