Replacing a crankset, do I also need to replace the bottom bracket?
No, the process of removing the drive side crank and axle by tapping with a soft-faced mallet will not harm the balls or races in the bearings. The balls and races are hardened and the axle is not a true 'interference' fit in the inner races so you don't have to tap the axle very hard to get it to move.
You can review the Park Tool Repair Help page on two-piece crank removal. If there was a danger of damaging the bearings it would be mentioned and steps to avoid it described.
I will note that I have encountered a FSA PF30 crank that was really tight in a SRAM BB, but you should not have that problem with Shimano cranks in high quality BB bearings.