The domestic market in Poland is not particularly interesting to...foreign investors
You seem to think Poland would just be another Belarus if it weren't for the EU. You are wrong.
Over the past decade Poland has done very well while other EU countries (especially the more older members) lagged and staggered along.
Poland actual competes with other EU member states for business and investments. Businesses which set up shop in Poland could have chosen other comparative and newer member states like the Czech Republic, Slovakia, Hungary, Romania or Bulgaria but they didn't.
No one in Poland ever told businesses to wait to invest and set up shop until Brussels or Berlin gave the OK.
Poland also smartly maintained the zloty rather than abandon it for the Euro which proved to be to Poland's advantage. That was a decision made in Warsaw not Brussels or Berlin.
You also fail to comprehend that Poland is one of the most populous countries in Europe (a large consumer base is always attractive to businesses) with a well educated and skilled workforce.
In 2016, Poland exported $196B and imported $186B, resulting in a positive trade balance of $9.6B. In 2016 the GDP of Poland was $469B and its GDP per capita was $27.8k.
Britain announced it was leaving the EU and it has been nothing but negotiations on both sides to keep some sort of economic deals going. But that's just face saving maneuvers among politicians. Seriously, what does Britain itself have to offer to anyone? Not much really. London (apart from its overpriced, ho-hum tourism along with the high chance of being killed by terrorists) only has The City (which is already being courted to relocate to Poland, Germany or France). Outside of London it is mostly bleak, shuddered high-streets. Any meager agricultural or manufacturing output has always been uncompetitive due to poor quality and the artificially high value of the British pound.
If Poland announced it was leaving it would be the end of the EU itself. But Poland would continue to be a world player especially economically thanks to the Polish government's policies which put Poland first.