My own personal theory on the matter is that the morphing technology has some kind of rudimentary 'decision engine' built into it. Like, maybe it accesses your memories and determines which things are "injuries" that need to be gotten rid of, and which things are necessary parts of who you are. I mean, if
everything was reset every time you morphed and you were rebuilt purely from genetic code alone, you would go back to being an embryo. A lot of things about you are determined only after you start growing, after all. Height, weight, and things like that are all affected by environment, and can be different even between two people who have the same genetic code.
Andalites are geniuses with computers, so it makes sense that they'd come up with a decision engine like that. And it explains haircuts, pierced ears, many Andalites' scars, etc. And Rachel could not trick it into giving her a different haircut because it would use memories, not current thoughts.
Anyway, the point I'm leading up to is, under my own personal theory of how it works, your surgery would be preserved.
Buuuut a lot of people could argue things differently, since my theory is pretty much not supported at
all by canon. For one thing, you'd think, if I'm right about the way it worked, Ax would have bragged about it a little. Andalites are, after all, insanely proud of their computer skillz.