The P series and X series use entirely different chipsets which require different code base. So no, it’s not the same firmware.
The gcode generated by Bambu Studio for the P series does have some unneeded carry over code from the X series. You can remove it by editing the start/end gcode added by Bambu Studio.