It's possible to define a derivative with a source_dsid and destination_dsid being equivalent. For example a MODS derivative that adds an identifier only if the identifier does not already exist in the MODS (has a terminating condition so it does not loop endlessly).
When attempting to delete a datastream the form attempts to get a list of related derivatives to given the user an option to delete any related derivatives if they see fit. With the current code this will cause non-terminating recursion.
Define a derivative hook implementation defined with the source_dsid and destination_dsid being equivalent (https://gist.github.com/jordandukart/b488ea8bdfe62a90754f9578ece1acb0 for an example).
If using the example Gist create a new datastream 'TEST' using the txt file as the content by going to /islandora/object/pid/manage/datastreams/add.
Navigate to /islandora/object/pid/datastream/TEST/delete
Note that you get a white screen with a recursion error.
Pull code attempt again, things work as expected.