See rP23185, rP23239 and ticket 2706
elexis
I'm not sure if it even makes sense to allow researching techs while upgrading, since the upgraded structure might not provide that technology.
Nescio
Entities shouldn't be able to train or research anything while (un)packing or being upgraded.
Messages are displayed to player when action cannot be done.
Petra does not upgrade entities, so do not care in this diff about her to not be able to start production.