Pirate invasions really should only start happening post-mechs. They're just not balanced for anything before that and if an invasion occurs early on in hardmode, it's incredibly tedious and unfun, especially on expert and master where most of the pirates can two to four shot you. Pirate captains are especially bad. They've got high health for this stage of the game, fire extremely fast, and deal extremely high damage. They're also difficult to stunlock without very fast weapons. The pirates work well later on and can actually be a lot of fun, but early on they're just awful. The mech boss spawns work well since they can be avoided and end when you die. Invasions, on the other hand, have to be completed. If you get one, you can't avoid it, you have to grind through it.