Here's a better way
Allow setting a timeout where if your phone hasn't been unlocked for a given number of hours it automatically wipes itself. Most of us could set that to 24 hours and run no risk of losing data. If you are engaged in criminal behavior, a shorter timeout might be appropriate. It all depends on what the longest time you could ever imagine sleeping is, I usually sleep 5-6 hours but approach 9 hours maybe once a year if I didn't sleep the night before...so 10 hours would work for me though I'd have to remember to unlock right before bed just in case!
You'd run some risk of data loss, since obviously you aren't using cloud storage (both Apple and Google will give up that data in response to a lawful subpeona) so backup frequently I guess.
Hard to see how you could be prosecuted for "destruction of evidence" for something automated like that.