I'm unsure of this because lobbies rely on proper configurations to ensure that people follow certain guidelines, but picking up weapons isn't prevented by any kind of command, neither the TF2Center rules page editorialise this. Most of the time I chooce to not obtain a free uber or kriz, but sometimes it's tempting especially if our team is losing, and from time to time I've noticed enemy medics doing it too.
Anyways, I've picked up a habit to always use the crossbow to either deal damage or heal whenever I'm being attacked, ensuring that I won't drop the medigun if I happen to die. Those bastards won't get a piece of me