No problem at all and no need of a special law. In Spain, all persons have two surnames, one from each parent. The law allows (for everybody) parents to decide which one comes first. So, no problem for Leonor's children to have de Borbón as their first surname. Even if the parents decide that their children will have the father's surname first, one can change the order of surnames, like the present Duke of Alba did.

Previous Message
Assuming that the Spanish monarchy survives for many more years, what would be the royal family’s name once Leonor’s heir takes over? Would they change it to Leonor’s husband’s surname, or would they follow the Dutch, Austrian, and Russian examples and just continue with “Borbon”?