I patch or add features to framework or libraries. Mainly because I need them to work and don't want to wait for them to fix / add it.
The last things were setting explicit transactions in the Query object of the phalcon framework -> so i can do my API unit / integration tests inside of a transaction -> which means I don't have to clean up the database after every test class.
-> start transaction -> execute tests -> rollback.
and the phinx migration library i refactored all unittests and added a new feature to drop specific constraints because I already used their system and I didn't have the time to write my own migration system.
Basically I patch others peoples mistakes because I'm egoistic, lazy and I don't want to maintain it. :)