TLDR
When I connect two USB-C Android phones together in the USB Preferences I can hot swap the power roles via the "Charge connected device" option.
How can I duplicate this functionality outside of two Android phones connecting together (i.e. when I connect my own custom 3rd party hardware)? I understand I will have to implement or make use of some USB stack hardware/firmware on the 3rd party hardware side, but I'm not sure exactly what standards are necessary. For example Digi-key produced a nice article describing the various USB specifications. So for Android Power Swapping comparability, do I need USB PD 3.0, or would USB Type-C 1.2 work, or USB BC 1.2, etc.?
Also I would like a link to some official confirmation that Android Open Accessory is NOT the current way to handle powering an Android phone from an external device despite what is suggested by the official dev docs. Instead it appears that USB-PD, or some other USB type C standard with Android remaining the DATA Host, while the external device being the POWER SOURCE is the current standard way of doing this. I haven't found anything about this in the Android dev docs so far and it seems very strange to me that something they haven't updated since 2012 is still in the official docs as the ONLY way of doing things.
It appears this USB Power Swapping functionality is not listed in the Android dev docs that I could find, but you can find the source code responsible for the hot swapping of power roles here
Detailed Background
I have a project where I need to power an Android phone via an external battery powered MCU. According to the android dev docs on usb connectivity, I'm supposed to have my MCU act as a host and implement the Android Open Accessory Protocol (AOA).
Looking for how to do so turned out to be a fairly deep rabbit hole, but in short I found manufacturers like FTDI that make dedicated ICs for handling AOA protocol, but their examples haven't been updated since 2012 and the AOA is hardcoded so any future changes to the protocol would require making new hardware.
I also have worked on the IOIO Board repo a bit (from the Android side), but looking into the firmware used on the PIC24F it looks like the original developer created a custom USB-Host stack that implemented the AOA and makes several comments in the repo wiki about how this is VERY hard.
Finally, I found repo that implements AOA on a MAX3421E. It appears this may have stemmed off or related to other projects in 2011/2012 surrounding the AOA like the Arduino ADK which is now obsolete.
It summary it appears anything surrounding the AOA or "ADK" is completely user or 3rd-party driven and nothing officially supported by Android/Google. For example, in the docs there is a link to viewing the "source code" for the ADK, but this link redirects you back to the same documentation (not the source code). I actually found the mentioned source code from a copy of it on an Instructables page by a 12 year kid with a link to the official repo. You're free to have a look at this code, but it is OLD and does not work with the current Android build system and you'd find the USB_Host_Shield_2.0 project to be much more well organized and easy to understand, which is based on the hardware from what I understand.
With how little support Android appears to be providing for this, it looks like it was all but abandoned since 2012 a year after it was introduced in 2011. Thus, I was looking for a more future-proof solution to power the Android device from an external controller. From what I can tell the modern way to approach this is to use a USB-PD controller to allow power roles to be independently selected from the data roles. For example, if I connect to Android phones with a USB-C cable, it appears the orientation of the plug/cable determines the Host/Accessory role with the default Power Source being the accessory. (i.e. from the screenshot before, this is the Host since "USB Controller By" set to "This device" and the Power Source is the opposite phone since "Charge connected device" is disabled here (and enabled on the other device).

I'll go ahead an post a potential answer, though I'm hoping for some official answer to override my assumptions and guesses.
From what I can see in the source code handling this functionality, there are three power roles of {POWER_ROLE_NONE, POWER_ROLE_SINK, POWER_ROLE_SOURCE}.
Following these imports, I can see here that there is a clear separation between power roles and data roles.
If I plug in the phone to a USB port not supporting USB-PD, this "Charge connected device" option disappears. It also does not appear when connecting the phone to a USB-PD charger. So I'm assuming the connected device has to show that is a Dual Role UFP | DFP in order for this option to appear.
If anyone can add any official documentation on this, and what USB standard (3.0, 3.1, 3.2, 4.0, etc.) is necessary and how this relates to which Android versions are supported for this functionality, etc., this would override this answer.