That said, I would say that making characters as three-dimensional as possible will avoid any sort of thoughts readers might have about the flatness of their presentation.
Yes, I think this is right. To me, if you approach all of your important characters (not necessary for unimportant ones) as people first, with personality traits you've defined to create the character, and then proceed by treating them as autonomous individuals with certain personality traits that you've given them, then you never really have to ask yourself whether X or Y is OK because the character is male or female. All that will matter is whether the act is in character (or whether there is a good reason for it not to be), and you'll know the answer to that without ever thinking about the sex of the character.