Now, this is a rather recurrent problem with me. I tend to think of the action of my MC first, and then their motivation. Side characters, other main characters - generally fine. But the MC is the one I start off with, and it is quite literally impossible for me to know them before I start writing them into a situation, because I don't do a heap of planning when I first start out.
The question is, what do you do, after powering through the first draft to the end, after realising your characters motivation is flimsy? How do you even recognise it as flimsy in the first place? (I had a lot of trouble with this one).
It all boils down to one very simple point. If you start the first draft without a plan, or without background information on you characters, you're going to get a lot of contradictory traits and motivation within your characters to start off with. Somewhere around the 1/4 mark, you'll figure you're main character out, and foget about that bothersome motivation that started the story off.
But it's still there, waiting for you when you get back. So how to fix it?
Just to clarify, you should not really be asking yourself what motivates your characters halfway through the book. If you still don't know them by then, you should really stop and think about what sort of people they are, what sort of history they have. but otherwise, there is normally one of a few things (or more) wrong with your character's motivation:
The motivation doesn't fit the character. It fits the plot, but not the character that you have by the end of the book.
There is no motivation, the character just does what the story requires
In both cases, it is a matter of deciding what you wish to change. It's your story, you can change everything in it. So do you change the motivation? Do you change the character so they fit the motivation? Or do you change the plot, so that the character that you have discovered by the end of your first draft now dictates a new story?
All of these can be done. Changing motivation is easier than changing an entire storyline, or changing a character to fit that motivation. For example, say Jane wants to get into a big business because she wants to get rich. By the time you get to the end of the book, you realise Jane doesn't care about money - she cares about her brother's health, and she needs to be in this business, because they're creating a drug that will help her brother with his illness. Now, you can go back, and change the motivation, make Jane want to get in to reassure herself about the drug from the start. Or you can make it so that she's originally interested in the money, but subconsciously, and gradually conscientiously, she becomes concerned about the medicine that her brother needs. That's changing the character so it fits both the motivation at the start, or the character they become. Or you can give up on the idea of the business entirely, and have this character, who you now know intimately, do something else to guarantee her brothers health.
In the end, the question is what do you like most about your first draft, and which solution is most believable? The character at the end, the new motivation you can come up with, or the old motivation. It all comes down to both personal taste, and believability.
I find it hard to believe that Jane would enter the company purely to check up on her brother's new experimental medicine. But join the company because she needs and wants money, and then slowly get drawn towards information on the drug? that I could believe.