Yeah you should really try to recognise that things are getting out of control and play back under turret before they get to the point tower diving is viable.
Still, if you are at that point, giving up the turret is better than getting dove, giving up your life and still losing the turret.
Depending on the champions involved and how far behind you are, roaming to gank other lanes might work, or just turning to jungle camps is the way to go. I probably wouldn't suggest leeching xp though, as you'll just set another lane behind, and your goal at that stage tend to let yourself be carried, rather than try to leech teammate resources until you can try to carry yourself despite the setbacks (which rarely works).
In some cases I've seen people pick up an ancient coin out of desperation if they can't even get close enough to last hit but don't have other options to get gold. Almost independent of your champion choice, falling back to full tank+zzrot (and/or banner) is a means to allow yourself to be indirectly useful without putting yourself at much risk of letting an enemy snowball off you further. I've even seen some mid lane mages go for tank+rot and be much more useful than you'd think under those circumstances, but try to realistically assess the situation and build in the manner that has the best chance of being useful (this is rarely going to be pure damage) given you're behind.