You can prevent this.
The tank needs a thorough cleaning. There are RV chemicals for cleaning a tank and the "Geo method" (google it) and you can also use liquid drano if it is extremely clogged up. Our owner's manual says to use it. Never dump the drano into an on-site septic disposal system.
When using your black tank, always put 4-5 gallons of water in it before each use. When p**p goes into the tank, use lots of water to flush it. If you do not use sufficient water, it will get plugged up. Fill the tank to almost full before you dump the contents.
Use a clear back flush elbow for rinsing the tank if you don't have an in-tank rinser (flusher). When it seems to be coming out clear, fill the tank up with water and dump. Check to see if you can see the tank bottom using a flashlight. If you see white (TP), it's not clean.
If you have a tank rinser, use it repeatedly until the tank is clean and you can see the bottom. If you can see droplets of ABS glue, it's pretty clean. Use the tank rinser as many times as needed until you can see the tank bottom. Let it run for 5 minutes or so each time. Then fill up the tank to near full using the foot valve (not rinser) and dump. Repeat as necessary.
If you use adequate water during use of the tank and then clean it really well before you head home, you won't have any more problems. Cleaning the tank takes some work and it's the first thing I start when breaking camp. We replaced the OEM button sensors with Horst Miracle probes and along with thoroughly cleaning the tank each time, we no longer have false readings.