Power source switching/isolation circuit
Edit: After some thought, I have decided that I do not like the solution below for the following reason.
Under the assumption that the circuit acts ideally as a diode, and under the assumption that the battery boost circuit outputs exactly 5V, there still seems to be a 50-50 chance that the external supply is greater than the battery boost 5V vs being below the battery boost 5V.
That means that some times, the load will draw current from battery, and some times from the external supply.
Although the load will work when the power is drawn from the battery, the battery will be drained, and if the external supply should become unavailable, the drained battery will be of no use.
What I personally would like from a circuit that may use either a battery or external supply for power is

if the external supply is available, it is used to power the load, even if it provides a lower voltage than the boosted battery voltage.

if the external supply is available, and has excess capacity after powering the load, it will additionally charge the battery with this excess capacity.

if the external supply is available, but it does not have the capacity to supply both the load and charge the battery at the same time, then it will supply the load rather than charge the battery.


These may not be the same objectives as you, but they seem reasonable to me.
The down side of these objectives is that I cannot think of a circuit that achieves them with the same efficiency as an &quot;ideal diode&quot;. The best I can think of involves a loss of power between the external supply and the load, possibly in the 5-20% range (80-95% efficiency). If my load does not require the amount of current that my external supply is capable of providing, I wouldn't mind that loss. However, if my load could only barely run with a standard usb supply, I might not be happy with such a loss.
I may offer an alternative that assumes that a 20% power loss from external supply to load is acceptable.
Original:
Try this (partial) circuit to isolate the power going into the charger, battery, and boost converter from the +5V rail.
(The switch is there to simulate that the external power supply might be disconnected. It is not needed in your circuit).



simulate this circuit &ndash; Schematic created using CircuitLab