Eh, it was pretty easy for Microsoft to do it. I'm playing Psychonauts 2 on Steam. In the options menu was a place to log into a Microsoft account. I did that and now I'm also getting achievements on my Xbox profile as I unlock the achievements while playing on Steam. I assume the same is true in other Xbox/Microsoft published titles on Steam, but I've bought all the ones I've played through the Xbox store for the Play Anywhere compatibility (I get a digital copy for both PC and Xbox at the same time).
So it's definitely possible. I can't even begin to imagine Sony doing it though, they're so greedy this generation. They have no Play Anywhere, they have no Smart Delivery (pay $10 if you want an upgrade, L-O-fucking-L), they don't even launch games on console and PC simultaneously and instead do staggered releases in the hopes people will buy the same game multiple times. They're not going to let you unlock PSN trophies by playing on Steam no matter how easy it is from a technical perspective, because that takes away an incentive for the player to buy both versions of the game, and Sony can't have that. Be a good little consumer and buy the game twice.