Losing attraction to partner after sex fails

Every time in the recent past that I’ve met a girl that Im attracted to and think I really like, something changes after I’ve failed to get hard with them. My desire to have sex with them just falls off a cliff, and so does my connection with them outside of the bedroom. I know this makes no sense because they haven’t changed, but it seems like something that happens in my brain that I’m unable to fight against. I think it’s caused the end of multiple potential relationships. Anyone else had this problem?