The term User Experience (UX) encompasses the concepts of design, business and engineering. However, UX has not been defined clearly. UX broadly describes all aspects of interactions between a user and a product. The concepts of UX covers usability engineering or even affect. Those concepts vary in terms of considered elements, objects and scope. One concept focuses on co-experience by considering the social aspects of UX. Another concept focuses on temporality perspectives of UX.
After all, what UX is?
In short words, I can be defined UX as developing something centred on how people actually use it can and what can it be vital to them.
Where in these processes should UX be?
Particularities of product contexts such as business models should inform how UX is defined. So first you need to define what are your business needs and what are the use cases. The answer is, you should define UX after those processes.

As you can see in the above image, Sunbonn show us where you should put every piece on a product development. First, you try to understand and are the business goals. Second, you define the business metrics and UX. Third, you start the prototyping phases. Fourth, deploy the final prototype as a final product candidate. Last but not least, the fifth stage, you do your analytics.
Search for users goals in b2b software is always appropriate and should be something recursively done during the process and after the process. You should first achieve user goals and second company goals. The second will be achieved by the first. Users as end-users should always be your focus and your main priority compared to business. Otherwise, a long-term crises will defeat the business stability and users will migrate to other solutions even in a B2B Software.