England, Scotland and Wales are countries.
Constiuent countries of the nation: United Kingdom of Great Britain and Northern Ireland
The ambiguity comes from many English speakers (British included) using “country” and “nation” interchangeably. A country is a place, a nation is a sovereign entity. The two tend to correlate these days.
The flag is a combination of the English and Scottish flags, a result of the Act of Union 1707, which permanently combined the thrones of the Kingdom of England and the Kingdom of Scotland into the United Kingdom of Great Britain.
Wales is not represented in the flag, as it had already been incorporated into the Kingdom of England, as a Principality.
As a result of the Act of Union 1801, which permanently combined the thrones of the United Kingdom of Great Britain and the Kingdom of Ireland, the cross of St. Patrick was incorporated into the Union Flag. This wasn’t really very much associated with Ireland at the time, but it looks cool.
So the United Kingdom of Great Britain and Ireland was the union of three Kingdoms, the English, Scottish and Irish, and so the flag is a representation of that union.
Nobody cares about the Welsh.
Another funny one is the acronym for the “England and Wales Cricket Board”: ECB