The writers have intentionally written her as a little bit unlikeable because they wanted a change after Montgomery.
Montgomery was more like a father figure in the precinct.. the wise old guy who gives advice but still has the reigns in hand. The reason why he kept Castle around was that he saw how good he was for Kate and i believe in the later seasons when people began picking up signals that there was something developing between them he encouraged it because "before Castle Beckett didn't have fun".
Gates is the polar opposite and it's just a different management style. She is career oriented and that means she wants results from her people and this is why she's driving them harder than necessary at times because she wants her precinct to have as good a record as it can be. Castle is a loose cannon.. he could fire any way and that makes him unpredictable and that's something Gates apparently doesn't like and only by mayor intervention was she forced to endure him. However i see her (very) slowly warming up to the fact that Castle can contribute which was very evident in this episode when she indirectly admitted that the Beckett/Castle team works very well. However even she has realized that there's more between them than just partners and that brought a smile to my face (and she said it with the same smile she so often displayed on DS9