Though this is not addressed explicitly in the movies, your comment did give me some insight into this. I believe the scene was multi-layered and showed us something of the nature of deception in the film. You asked why did Bruce Wayne do this? -- but relations are a two-way street, so one must also ask, why did Miranda Tate do this?
I analyze the scene this way:
We saw Bruce Wayne making love to Miranda Tate. We did not see Batman making love to Talia al Ghul, at least not in those roles. And remember, both are trained in the League of Shadows and not subject to ordinary lapses.
I believe it's possible that both of them had ulterior motives: Bruce Wayne perhaps to ensure he was not seen as the unapproachable Batman; and Miranda Tate to get more of an inside position in Wayne Enterprises, so she could move closer to her own goal.
But at yet another level: both Bruce and Miranda are at the core human beings with human failings like pain, revenge, anger, despair. One must conclude that lust is also a failing they share. Perhaps they can sublimate their desire in most cases. But when each of them met another perfect specimen - both are in superb physical condition and of above-average looks and intelligence - well, maybe they couldn't or didn't want to resist. Yes, this is dangerous. By remaining within their Masks as Bruce and Miranda they could partake of the sensual experience yet remain psychologically insulated.
So in contrast to my earlier comment, I think that the scene was intended to depict the layers of psychological barriers each of the characters carry.