It seems like it should have been possible to achieve by adding tilt and shift movements to the enlarger lens, projecting a keystoned image of the film on the printing paper and cropping accordingly, but was it ever done ?
This perspective correction was done all the time. It's very effective.
It can throw off the focus of the image on the easel. Stopping down can help with the focus if the "correction" isn't too severe.
What to do?
Small corrections in the negative holder can be used to tilt it in much the same way as a view camera uses shifts and tilts of the lens board to much the same thing.
Here's more about it with some illustrations from the "Printer's Attic".