See this StackOverflow answer.
One option is to redefine the function after the package is loaded. So, use eval-after-load.
This is how I overrode rspec-mode’s function to use spring by only checking the flag rather than all the additional PID checking it was originally doing. I did this so I could more easily use with Docker.
(eval-after-load 'rspec-mode
'(defun rspec-spring-p () 'rspec-use-spring-when-possible)
)
Advising Functions is more appropriate for adding callbacks to existing behavior. More about this in Emacs cheatsheet.