Tile Palette is a container for tiles, which in turn AFAIK are Tile asset files. So I don’t think messing up Tile Palette would alone corrupt your Tilemap. Maybe you accidentally removed or altered your Tile assets in project? I’m not saying what happened to you can’t happen, I haven’t used Tilemaps that much anyway…
Anyway, what @rarac said sound like a good advice. For example, you can easily read all the tiles in your map with Tilemap.cellBounds. Loop the area you get from cellBounds and store each tile you find (coordinate and tile asset name), and save this data to a file. This way you can be sure that you have your map data even if you somehow break your Unity project or Tilemap. You can then later reconstruct your map by reading your data.
I guess this would be likely to occur if you are updating your Tile Spritesheets periodically, eg. adding new Sprites to the Spritesheets. Here are some of the pitfalls that can happen:
Sprite Editor:
After adding new Sprites to the Spritesheet, you would likely need to slice the Spritesheet again. The default method when adding new SpriteRects is Delete Existing. This would remove all existing SpriteRects on your Spritesheet and add entirely new ones. Unity will try to relink the references based on the name of the new SpriteRects if they match with the old ones. Name matching may not be accurate depending on how new Sprites are added to the Spritesheet.
Change this to Safe to avoid losing your existing Sprite Asset references, and add only the new Sprites. If the Sprite Asset references are lost, Tile Assets will not know which Sprites are used.
Tile Palette:
After the new Sprites have been added, you would need to add them to a Tile Palette. The usual way would be to drag the Spritesheet texture onto the Tile Palette. This would prompt you on where to save the Tile Assets.
If you have existing Tile assets, you can save them in the same location. This will bring up a prompt on how you would want to save the Assets. Select Reuse to reuse the existing Tile Assets and keep their references. Selecting Overwrite will create new Tile Assets internally with new internal references, but keep the filenames. As these Tile Assets have new internal references, existing Tilemaps will not recognise them and will appear corrupted.