Pseudonyms, and also professional ghostwriters hired to help a celebrity push out a book, are such common things that publishers and agents have contracts and legal departments to accommodate them. As was said in the other answers, the person getting paid being different from the name on the cover is "business as usual".
Probably the only threat to a pseudonymous author is if they become too popular, or are already famous under another name. JK Rowling and Steven King were both discovered because their (already famous) writing was recognized. In the case of King, a bookstore clerk played detective after recognizing King's style. Rowling was supposedly discovered through computer analysis.
Both were good-natured about it. King actually encouraged the bookstore clerk to write his discovery as a mystery article and agreed to be interviewed. Rowling always manages to be the most gracious billionaire on the planet. But they had nothing to lose except the pleasure of seeing their books appreciated without the shadow of their own fame. King's publisher had actually refused to publish more than one Steven King book per year out of fear of competition from his own novels, so the pseudonym had been a compromise. Rowling wanted to break out of the schoolboy wizard albatross she'd created for herself.
However, recently "Elena Ferrante" was outed by a journalist who claimed because of the popularity of her novels she was a public figure who has no right to privacy, but she was not a known name or a public figure. She just valued her privacy. The publishing world made a big fuss to shame the journalist, but it's likely the shame-campaign created more publicity than the original article.
In all 3 cases, the publishers attempted to shield the authors, but also in all 3 cases the publishers were the Achilles heel leaving a paper trail of large payments and legal documents that led back to them. In the case of King and Rowling, the authors had used their same agents and publishers, making their identities easier to confirm.
True anonymity may not be possible in the internet age, not if it is combined in any way with success. If your pseudonym is about aesthetics, don't fear the publisher. However, if the pseudonym is about maintaining true anonymity, unfortunately there are no guarantees.