Problems about developing a adb extension

That wouldnt work. You can only execute normal Android Shell Commands from Java, that too a limited set of commands unless you have Root Privilege.

Also you cannot directly execute ADB commands from within the app, you need a kind of ADB server to be hosted on to the phone itself to do so.

Some related apps which does this: https://shizuku.rikka.app/