There's nothing technical stopping us from investigating and modifying the apps we install - at least on operating systems that allow you to install unapproved apps. YouTube Vanced only got in legal trouble for distributing a copyrighted work (the YouTube app) which led to ReVanced which is a patcher that doesn't include a copy of the original app.