Is this the 13" or 15" model? Apple has a free repair program to address a potential fire safety issue (Battery Recall) for the 15" model which apparently is still active (it is still listed on Apple's site for free repair programs):
15-inch MacBook Pro Battery Recall Program - Apple Support
If you have the 15" model and your laptop's serial number is confirmed to be part of the Battery Recall program, then you may not want to use that battery. If your laptop is not part of that Battery Recall, then you should be Ok to quickly pull your data from the laptop. Since I know the others object...to be extremely careful, you can take the laptop outside & use an external keyboard & mouse to keep the laptop away from anything flammable as well as to allow you to keep a bit of distance. Have a small container of sand handy ready to throw onto the laptop just in case of a fire so it can be safely smothered.
Apple doesn't consider a swollen battery as a fire hazard. In fact Apple only ever had one free repair program which was to address a fire safety hazard (the one I linked above). Apple had other free repair programs to address swollen batteries. Apple never mentioned any fire safety issues or any real safety issue with the swollen batteries programs. Of course you never want to have a battery leak any of the chemicals or in the case of a swollen battery... any of the gas since both are toxic.
While you usually don't want to use the laptop with a swollen battery, in your specific case where you only need to use it for a very short while to retrieve data.....you should be Ok to do so. You may find that the battery will increase its swelling which could cause the Bottom Case to warp and to push out the Trackpad. You should definitely have an external keyboard & mouse handy.
FYI, in the future you should make sure to always have frequent & regular backups because there are a lot more new ways to permanently lose access to the data stored on the internal SSD of the recent Macs due to all of the hardware, software, and security changes.