You can’t do that without unlocking the bootloader, and that alone will trip “root detection” (Play Integrity).
Some apps take it further and won’t run if you enable Developer Options! (Or have any number of “hacking apps” installed, such as autotap apps that don’t even need root.)