In the first example, they didn't and recruited a CTO who made a tool choice that arguably killed the business (maybe it still ends the same with PHP, minus the experience of building a nicely architected system in Perl: what-ifs all around).

Management does need to care to ensure they hire people who will make the right choices (which is a careful balancing act of investment vs returns) if they don't trust themselves to do it.

CTO is management.