I'll answer by extrapolating, no doubt somewhat naïvely, from my experience as a teacher in my second year.
When I began, I found that I loved teaching one or two kids, liked a few, shrugged my shoulders at a few, and hated teaching one or two. They hated my class and I was undermined by them, and we had nothing in common. I would have wanted them out of the class and would even feel happier on days when they were gone for any reason, because I could focus my remaining attention on the others, without these kids' misbehaviour and pushback and disruption. I felt guilty about this attitude, but couldn't address it head-on.
Now, I find that I love teaching many kids, like almost all of them, have no particular opinion on one or two, and hate teaching none of them. I also would like to get to know those last couple of students well enough to learn to like them. In fact, I often catch myself thinking and sometimes say (when addressing misbehaviour): "Even so, I wouldn't trade any of you." While the students might not realize the weight of that statement to me, the comparison with where I started is so encouraging.
So how did I get there? I believe there are two main factors:
1. Competence. I've become a better teacher in terms of classroom management; projecting my voice and projecting confidence; putting out fires; anticipating questions and confusion when planning materials; figuring out where to go in a new course, and estimating how much time a new activity will take; and many other metrics. Of course, I'm still in my second year and have far, far to go. But I feel OK about the job I'm doing and almost never go home beating myself up over how badly a lesson went, compared to last year. I'm much less frustrated, and that lack of frustration translates directly to greater enjoyment.
2. Emotional investment. I do my best to get to know the students and let myself be known. I often think of what a mentor teacher told me: "Every day I ask myself: What did I learn about them? And what did they learn about me?" Believe it or not, you don't have to depend on chance but can indeed choose to create emotional investment in a person by intentionally asking and listening and connecting to what they say.
My current strategy is to choose a question every day - from fun ones like "What's the worst fruit?" to deeper ones like "When have you felt truly scared?" - and ask it of every kid, writing down their answers in a shared document they take home at the end of the course as a record of who they are at that moment in time. Every day, every kid tells me something. And I find that the more I know, the more I want to know, the more I want to choose good questions, and the more I'm curious what they'll say if I ask about X, Y, or Z. Often, the students who are academically frustrating actually have the best stories, so I end up liking half the class because of our learning synergy, and the other half because their lives are interesting and they make me laugh.
I also try to create this emotional investment in my students. A favourite activity in English is an interviewing one where I first give them some empathetic/active listening tools, then have them write a bit, then have them interview each other using questions like "What is it like to be you?" as well as questions of their own choosing. Several students have pointed to this opportunity to get to know their peers better as a favourite assignment. But you don't need to be a teacher to ask that question. Looking at your child, you can ask (yourself for now, and them when they're old enough to answer): "What is it like to be you?"
The surveys for my first courses rated me high for being knowledgeable and passionate about the subject, but not for being respected by the class or caring about the students. In more recent surveys, these latter factors have climbed to about the same or higher than the former. Note that respect to a student means classroom management competence and care means feeling understood — the two factors above.
There's good news and challenging news for you in the takeaway. The good news is that you will inevitably become more competent. Just keep an open mind and regularly ask yourself how to adapt and do better than yesterday, and you will.
You had an easy run with your first child. Now you have the real thing and you're feeling helpless. This happened to me too: after my first practicum, I was told I was already teaching like someone finishing their final practicum. My ego swelled. In retrospect I see that I just had a fantastic mentor and a good class. So I went into my second practicum with too much confidence and it was much harder. I screwed up in many ways and I was even told I should consider quitting the path of teaching. I lost all joy in the work. But I needed more time, more practice, more accountability. What's more, I needed distance and a chance to start over. Three years later, my students say they enjoy my classes and I enjoy teaching them. So stick with it. You have been blindsided by child number two. But you'll get there!
As for emotional investment, that too has to wait a bit if it doesn't come automatically. After all, the kid has to develop a personality and individuality for you to invest in. But when they do, and even starting now, your outlook has to change. What do you know about who they are inside? How can you learn to know them better? (Remembering that questions like "What is the worst fruit?" can be just as good at sussing out a personality as deeper ones.)
One day a particularly candid student to whom I had explained some of the difficulties I was facing with teaching looked me in the eyes and gave me one word of advice: "BOND!" It requires a lot of work, a lot of intentionality, and a lot of self-critique to do so. But the reward of loving instead of hating students is so worth it.
Finally, I should inject the wisdom of an older friend I just mentioned this to. He heard the topic of the thread and then said: "Welp, that does happen. It could be a hundred things. I have a friend who didn't like her kid for a long time. Now it's better, I think, but not great. There can be a mismatch between parent and child. Or the child has an irritated bowel and will always be fussy. You never know." No doubt there's as much truth in that as in my bright-eyed non-parent optimism. But at the same time, if the question is how to proceed with the most hope and likelihood of getting along, I've found the above areas of focus helpful in my own situation. Hopefully they're of some use to you.