Well, basically, it is up to her. A quick question that may have bearing - is this adopting her spouse's family name or some more fundamental change?
What I see as the two main options - note what I'm calling option 1 is particularly 'easy' in many respects if she's adopting spouse's name.
1) Wait until PR is complete and then go through the process of getting the change of name recognized formally, which will mainly consist of getting documents swapped out to show new name on basis of legal name change documents. In most cases the foreign change-of-name docs will be recognized with the new foreign passport to reinforce/support. Note, in Canada, in many contexts she can begin using her 'new' name before the formal documents reflect - she just uses the new name. Nobody is stopping her from having business cards, using name socially, using it for business purposes (with caveat that things like paycheques and legal docs will likely need docs to support). It's not unusual for people to work somewhere (for example) using one name and only or primarily HR will know the legal name. The explanation is particularly easy if it's one's spouse's name - but in most/all cases you say 'this is my name now, some docs are pending to have this completed legally.'
It's actually okay to use one name in one context (eg socially) and another professionally/for business as long as consistent. There are some *caveats about how to do this if you want to do consistently/permanently (like a stage or pen name or a 'business personality') that I'm not qualified to go into in detail. (Main thing is that it absolutely is and can be a crime or make one liable to use such names to defraud somebody else or hide from liabilities and creditors etc. If you're doing it in good faith and open about it - mostly no issue).
Which is to say (overall): procedures to change name and get new documentation are pretty well established and reasonably clear once one is a PR. Just takes some time, forms and some costs. While doing so, she can mostly use her 'new' name.
2) Change it now. The first steps will defintiely involve getting a new foreign passport, and legal copies/translations of the original change of name legal doc. Would likely help if more than one type of identification has the name change - just because lots of places may ask for two pieces of ID and while the passport + other IDS in old name + legal name change doc may formally be enough, may be requested.
The biggest challenge, bluntly, is that there are probably not many formal procedures or explanations about how to change name DURING a PR process AND during a visit under a visitor visa. Or if there are procedures, they're not frequently used. (Side note: likely MUCH less of a big deal if just adopting spouse's name, because this happens a lot). That doesn't mean it's not possible, just might cause minor quirks (eg unclear under which name the PR file is, mismatches between files, small confusion in doing the background searches/checks, etc). There might be mistakes along the way.
Basically to do this just submit foreign passport (new), change of name legal docs, and ask to have this reflected/changed in file permanently. Only way to submit is by webform. And then wait and see what IRCC does.
It is possible it will all go smoothly and no issues. Or it might cause delays and hasssles. Depends on priorities.
One side note: I don't think this would be 'fun' and more prone to errors if the person in question plans to travel and leave Canada during the PR spousal sponsorship. And basically I personally wouldn't risk it, because chances of not being able to return/travel easily might get complicated. If in Canada and remaining - well, likely no issues inside Canada. Another side note is what happens if the foreign passport has to be submitted/destroyed when applying for new under new name (depends on country of issueance).