I build apps which generally have a lifespan of 10+ years - the current main one was build over 10 years ago and was never touched or updated and it's a monster :-(
I tend to pick PHP packages for them if it's going to save me a lot of 'fiddly' stuff and time - and if the people who wrote them seem to be fairly committed. So for instance in the 'monster' app there is a whole lot of image storage/processing and I've used the Spatie medialibrary as it does a whole lot of what I'd be implenting myself and does it well. I've also got a markdown converter and a pdf exporter in there as it's a lot of time to do yourself and PHP has some pretty mature packages for it.
For javascript though - it's a harder call. 'Mature' in javascript-land can often seem to mean 'was released more than an hour ago' ;-) I once spent a day implementing a javascript feature and by the time I'd finished the package I was using had gone through two 'major' releases and changed it's API completely :-/
It's always a bit of a judgement call - as your say - time saved vs. abandonded/customisation/etc. If I feel the need to pull in a PHP package I'm not 100% on, I'll quite often wrap it in my own 'decorator' with just the features I need exposed. Then at least if it goes away I can keep my 'business' code the same even if the underlying package has been swapped out.