I noticed that when I flash the firmware, parameters like SYS_CTRL_ALLOC
(parameter that enables control allocation, documented here) get reset.
This causes the vehicle not knowing which airframe it has & user needing to setup the airframe from the beginning.
p.s. Battery cell count parameter is also reset, so user needs to configure that as well 
Why is this happening?
From which to which version did you flash? They should not generally reset but in case a prameter did not exist before and you flash back and forth or there is some explicit transition set up like e.g. here: PX4-Autopilot/param_translation.cpp at 19b9b052ab59f06b2336f03cde42c2f498bf63d3 路 PX4/PX4-Autopilot 路 GitHub those could be reasons why they get changed when flashing. For the battery cell count there was some specific compatibility transition logic that got removed here: delete deprecated BAT_* parameters by dagar 路 Pull Request #16382 路 PX4/PX4-Autopilot 路 GitHub so that might be related depnding on the version.