Companies will take in a recent graduate (possibly a former co-op student with them), and over 10-ish years promoting them to a senior role. Sometimes without teaching them many valuable things that modern programmers know outside of their company.
That is pretty old-school in terms of hoping that employees can be groomed into “lifers” at the company, but it still happens.
Ideally, management would encourage you to grow within the evolving industry standards (not just the company norms), knowing that you may one day voluntarily leave, with no hard feelings.
The longest I’ve stayed at a company was 8 years, and thankfully, a modern Senior Developer came in from outside and taught us all the new ways a couple of years before I parted ways.
Sorry you had to learn the hard way. Picking up test automation, unit testing, code coverage, design principles, etc. is hard enough when you’re set in your ways; I imagine even a lot harder learning when you’re just trying to survive/keep relevant.