The bottom line is that it's always better to know, than not to know, what someone is really like when the chips are down.
A responsible, reliable, normal adult man when confronted with a youngster flirting and crossing boundaries like this would immediately see how inappropriate the situation was and take the very easy steps needed to remedy it. It would be shut down long before his partner got to notice it. In fact, it wouldn't have even progressed for a second, because the sad fact is that in order for it to get to the stage where the 17 year old is confident in approaching, teasing, posting etc., he would need to respond giving the green light. Jokey replies instead of neutral. Posting back instead of ignoring. Responding, all the cues and signals, we all know EXACTLY what they are. So does she. Not her fault, at 17. His.
You've seen that your partner is not reliable, not sensible, not appropriate, and is in fact a total prick when these particular chips have come down. Why - because he's flattered, I suspect- not accusing him of having any dodgy ideas necessarily. But that makes him thick as pigshit, too - he's getting a cheap thrill and a bit of an ego boost, he KNOWS it - he know you know it too - and he thinks that's worth upsetting you massively, worth revealing himself as a lechy twat who doesn't give a shit about his pregnant partner's feelings, worth undermining how you think about him and worth making himself look an idiot for? What an absolute plank he is.
This isn't trivial at all. He thinks it is. It isn't - not because he might get his end away with the teenage neighbour, but because he's showing you that underneath, he's inappropriate, stupid, thoughtless, and disloyal. Not great qualities. I don't know what you should do right now except tell him how utterly surprised and angry you are to see another side to him, and how it's really making you re-evaluate what kind of a person he really is.