Short answer? No.
Different States have different statutes on taking and/or driving a vehicle without the owner's consent (for example 14-102 in Maryland and 10851 a VC in California [commercial rather than government sites linked]), but law against taking without consent seems present across the US. It's worth making the distinction between theft (intent to permanently deprive) and taking without consent (intent to temporarily deprive).
In this case, there could be grounds to argue intent - that depriving the owner of use of the vehicle was incidental to the intent to escape.
In similar cases, a prosecutor may decide that intent to deprive was not established, or that prosecution is not in the public interest. A court may find Person A not guilty, or that there was significant mitigation of the offense - the website linked for California specifically mentions duress as a defense. But none of those are the same as the action being "legal".
The scenario is at best only telling half a story. The prosecutor and court are likely to be far more interested in how long Person A drove the car, and what attempts they made to return it to its legitimate owner.