IANAD, but it might be that your doctor isn't an expert when it comes to rehab (have you seen a physiotherapist?). You're on to something in the comments:
But there is some people saying it would help keeping the musculature even on the injured side, it's a quite strange topic
This is true (both that it's quite strange and that training one side can have a positive effect on the other). It's called cross-education, and has been known for well over a century:
Since its discovery in 1894, subsequent studies have confirmed the existence of cross education in contexts involving voluntary, imagined and electrically stimulated contractions. The cross-education effect is specific to the contralateral homologous muscle but not restricted to particular muscle groups, ages or genders. [...] While many features of cross education have been established, the underlying mechanisms are unknown.
The research about cross-education seems inconclusive whether it works for rehab, but it does seem to indicate that it is at worst harmless (i.e., it's most likely not bad for you, even if we're not sure it's actually good):
Amidst the limited evidence from large RCTs, can we say that cross-education is a viable method of rehabilitation? Indeed, most clinical studies are positive, and critically, none report negative outcomes. The risks of cross-education were based on the premise that it can worsen inter-limb asymmetry and exacerbate neglect of an impaired limb. But clinical studies so far suggest upper limb asymmetry was in fact reduced by cross-education and
lower limb asymmetry was not worsened. Clinical emphasis on avoiding asymmetry may be short-sighted because it diverts focus from the absolute functional capacity of the impaired limb.
Still, it's not guaranteed to work. Another study from one of the authors of the above article says that how well cross-education works might depend on your handedness:
Cross-education with hand strength training occurs only in the right-to-left direction of transfer in right-handed individuals. We conclude that cross-education of arm muscular strength is most pronounced to the nondominant arm.
So there's a lot of ifs and buts, it might or might not work. Still, it seems worth it giving cross-education a shot (but as always, be careful and listen to your body).
But is there a risk for imbalances? Well, as already mentioned in the comments, imbalances are not inherently bad (for example, the vast majority of people aren't ambidextrous and have a dominant hand). Still, imbalances are not inherently good either, but they might actually be exacerbated by not working out your non-injured side.