Generally to rasterize text, you must tell it to do so. Though I am sure some actions could that as well. Keep an eye on your layers and if it does happen that's the time to undo it. Save it and continue on. Get in the habit of saving every once in awhile. If you plan on doing something extreme, like merging all layers that may be the time to work on a copy of the file. It is called versioning. You put a sequential number at the end of the file name. When your satisfied, you can remove them later. But using versioning will allow you to go back several steps beyond what the history states would normally take you.
You could also go into preferences and change the number of history states. Doing so will increase the amount of ram needed for that document.
You could also group the layers and make a copy of the layer and hide the copy. It will stop it from showing in the document but would stay in the layers panel where you could copy a layer to fix the bad layer.
So there are a lot of things you can do to prevent issues, it is up to you to decide which would makes the most sense and easiest to perform.