The question is about the Regulation (EC) No 261/2004 of the European Parliament and of the Council of 11 February 2004 establishing common rules on compensation and assistance to passengers in the event of denied boarding and of cancellation or long delay of flights, and repealing Regulation (EEC) No 295/91
There it says in article 3 "scope":
- This Regulation shall apply:
(a) to passengers departing from an airport located in the territory
of a Member State to which the Treaty applies;
(b) to passengers departing from an airport located in a third country
to an airport situated in the territory of a Member State to which the
Treaty applies, unless they received benefits or compensation and were
given assistance in that third country, if the operating air carrier
of the flight concerned is a Community carrier.
So in short words: It's relevant that your journey starts or ends in a country to which the treaty applies. The country the airline is headquartered in or licensed by does not matter. Also it won't matter that you have a stopover in the EU.
It would be different if you were on two separate tickets, one from non treaty country to Germany and a separate one from Germany to the US.
And on a side note, beware to double check the meaning of
territory of a Member State to which the Treaty applies
In many cases it's pretty clear what that means, in others it's more subtle. For example, Greenland used to qualify, but doesn't any more. There is even some find print in the treaty about Gibraltar airport.