Domestic flights from T5 can only leave from T5A so you will indeed have to return to the main building. However any flight can leave from 5A so you might not have to go to 5B or C.
If you find yourself in 5B or 5C, you can walk back through the pedestrian tunnels in the basement. These are called the “Transit Walkway” on the signage, but I think everyone calls them the tunnels or the passageways.
At a brisk pace it is probably about ten minutes back to T5A from 5B, more like 20 minutes from 5C though. The passageways are open to the public and sign posted, although not clearly. You mostly encounter staff and people being transported on electric golf buggies down there. However a growing number of T5 regulars know and love the tunnels, as a faster, quieter and more reliable alternative to the train. Unlike the train you can go in both directions.
Here you can see they tried to make the passageways a bit more friendly with stylish purple lights and moving walkways. The moving walkways only run in the “main” direction though, you’ll have to walk around them.
It is faster to take the lifts down rather than the escalators or stairs, you want button “-4” in 5B. Then you walk down a short flight of steps following the sign for “Transit Walkway”. Note that in 5B you have to use the lift by Boots (gate B36) not the lift by Harrods. In 5C, you have to go down to the train platform and then there is a set of double doors at the end of the platform which leads into the passageway. There are separate tunnels for arriving and departing passengers and there is no way to get mixed up. A member of staff will be happy to direct you if you ask.
A photographic guide to the tunnels is available on FlyerTalk, be sure to read posts 3 and 4 which concern exactly your question.
Do not try to take the train back. The train, on the way back to 5A, carries arriving international passengers to passport control and connections security. This will get sticky for you if you have no ID, and even if you have a passport, it will confuse the Ready to Fly system which will assume you are already airside and deny you access through to security. (This can be fixed by BA but not by the Heathrow Airport people next to the gate.)