My question would be what is going on in this guys life that he feels the need to do this?
Has he been ostracised by his family for some reason. Is he desperate to belong/ be an uncle or father because he’s missing out? Has he recently broken up with someone and just needs someone to need him for a time?
None of this excuses his behaviour but it may provide some insight.
On the whole women do not view gay men the way they view straight men. There is generally zero sexual tension and more of a brotherly aspect to things.
Does the wife feel like she is helping him out by including him? What does she get from the relationship? She might just like a good chat about trashy tv that doesn’t interest their partner (and yes I know I’m stereotypying but I do so to point out that people bring in different energy and conversations).
Would the guy feel differently if his wife’s friend was a woman who picked her up and spent the same kind of time with her?
However, I do agree that disciplining the child (regardless of who they are) is a line crossed.
I would suggest gently asking what the go is? Try to be curious rather than angry. It may help to understand the issue and they in turn may then realise how lines get blurred and overstepped.
Just my two cents…