As it's 2am here, I'll rattle off assorted bullet-points in no particular order:

* The UK's sudden deindustrialisation (1970s-1990s) was inevitable but foreseeable and yet still poorly managed by both political parties, IMHO: my perception is Labour was more interested in propping up whatever heavy-industry remained rather than ease the UK into the future - and as for the Tories... probably best I say nothing there.

* Even before deindustrialisation the overarching business-culture in medium to large businesses in the UK was, and still is, tied to the entrenched class system, insofar as the board-level positions, upper management, sometimes even middle-management, and many specialties like legal, are held by a kind of unofficial aristocacy that looks-out for each-other rather than what's best for the business that they run (let alone the country): some combination of Eton, Harrow, having read Classics at Oxbridge, you can see what I'm getting at. This alone explains how Boris Johnson won his party's leadership and remained in-office despite clear evidence of misconduct in office, and so on and so on. Nepotism is rife here: the middling, uninterested, types get to work at daddy's friends's firm if they can't get recruited by the banks when they do their milk-runs.

* For reasons I haven't fully explored yet, despite the UK being the birthplace of the industrial revolution, and of so many inventions we still rely on today, and of great engineers like Isambard Kingdom Brunel - the engineering profession was never elevated to something Etonians would be interested in - it became a very middle-class occupation. That itself isn't a real problem as far as I'm concerned - the problem comes back to how the layers of management would be literally a class apart from engineering, and that class-divide results in engineering being excluded from management and leadership decisions, no-matter how central or critical engineering is to the company's identity or very purpose - for this reason you won't find many former-engineers being promoted to leadership or management or their experiences and inputs being valued: after all, the board read Classics so of course they know far better about how to run a successful business than a silly engineer from Lancs who plays with his funny slide-rule all day long.

* Even in more progressive companies without the problem of aristocratic management it's difficult to get access to capital, especially for anything remotely risky.

* A small, but still contributing point, that I feel matters slightly, is that different social groups in the UK tend to have differing mental pictures of what "engineering" even is: for many people (possibly even most people? maybe at least oop north...) they'll tell you an engineer is someone who stokes the fire on a stream-train, or fixes their telly when it breaks - MAYBE a civil-engineer - while our preferred answer: "someone who solves problems" would probably be 3rd or 4th down on the Family Fueds survey screen. This is my perception and I hope I'm wrong. As an anecdote, I was in secondary-school and 6th Form during the last of the Labour years when the careers advice service ("Connexxions"[1]) was pushing a very egalitarian view of how careers, further-ed and higher-ed, and professional development should operate - I support their goals, but I feel they got the messaging wrong and misrepresented how many careers operated - for a solid example, I still have my A2-sized full-colour print careers guidebook (with lots of flashy photos to boot) we all got when we were 14 (15? 16?) which certainly contributed towards the perception that (excepting civil engineering) that "engineer" is just another word for "technician": while the book did do justice to civil and chemical engineering, it made no mention of software engineering or electronics engineering, while mechnical engineering was really under-sold to its readers, and electrical engineering was down-right misrepresented. Experiences like these are only going to put-off kids from considering engineering precisely at that age when they're thinking about what they want to do with their life.

* More broadly, I don't think the UK really has many (any?) public-figures who are celebrated as engineering figures - in fact all, of the celebrities I know who have engineering backgrounds got famous for deciding to stop being an engineer: Rowan Atkinson (Mr. Bean) is an elctrical engineer who went to Queen's College, Carol Voderman did engineering at Cambridge, and so on - while the people I suppose we could be celebrating, like James Dyson, clearly act against the interests of the UK's engineering sector (he moved huge chunks of the company to Singapore). Yes, we have Rolls-Royce jet-engines, BAE Systems, and an assortment of luxury carmakers - but I'm convinced they're only still around because they are strategic national interests, and the UK government has had to bail them out of bankruptcy more times than we'd like, so excepting the defence sector, the UK has no real equivalent of NASA with which to inspire its young children, pre-uni students, and mid-career-shifters.

* Another aspect that I think matters, even if only somewhat slightly, the attitudes of those-in-charge (regardless of their class background: Tory or Labour) towards people-on-the-spectrum and those adjacent to it (i.e. us) - it's a nebulous thing I can't pin-down easily - but until 6th Form I was under constant pressure to conform (because if you don't support any footy team at all then you must be a right spesh) - it starts right from Reception year in Primary. Of course this is not unique to the UK, I've heard the exact same stories told from people I know who grew up in Iowa or Idaho - but those states aren't exactly known for their engineering sectors either. This extends to an undercurrent of scepticism of things like ADHD; while paternalism and gatekeeping remain in the medical profession, especially in mental health (though things are definitely better than they were 20-30 years ago) - right down to the anti-trans crap Rishi Sunak is still pushing to deflect criticsm of 13 years of Tory rule, never mind it led to the murder of a teenage girl. At least David Cameron wasn't that bad.

* One of the things that Boris Johnson's government did while in power was to up-end the 6th Form examinations system - I'll admit I don't know all the details, but I understand his changed the system to be much closer to the (almost social-Darwinian) way things were when Boris himself was doing his A-Levels: where your final subject grade depends far more on how you do in your finals exams instead of continuous assessment/coursework, with no or very limited opportunities for resits, and removing choices like a-la-carte module selection - but it is exactly and only because of the flexibility afforded to me when I was at that age that my comorbid ASD+ADHD-addled brain was able to get into university (and a very good one at that), whereas I'm certain that I would not be able to manage today with that level of intense exam-prep in only a 2-month window - and without my degree I would not be able to qualify for the H-1B (where a BSc is an absolute requirement) and eventually get my US Green Card.

* It is true that the UK does, actually, succeed in software in one crucial area: video games: Rockstar, DMA, Rare, Codemasters, Hello Games (No Man's Sky), just to name a few - but as others in this thread have remarked: successive UK governments, again, regardless of party, fail to give the sector the credit and support it needs and the UK's success here is in-spite of everything, not because of it. Crucially, the UK's games sector was built on the home-computer revolution of the 1980s - successive governments have had plenty of opportunities to repeat that success, but so far all I've seen is the 2016 BBC micro:bit project - which honestly felt like a gimmick than something to inspire kids with.

* Things aren't all bad though: I'm happy to see things like Scratch being taught in primary-schools and A-Level Computer Science now being closer to undergraduate level than glorified-ICT than it was in my day - but these things won't address the larger social, cultural, and attitudinal issues at play here.

[1] https://en.wikipedia.org/wiki/Connexions_(agency)