I know that it would cost hundreds of millions of dollars to do a 51% attack on Bitcoin, but if somebody did that, bought the hardware, etc could Bitcoin Core or any other software be easily configured to do what they want (e.g, ignore blocks containing a certain transaction in order to try to get rid of it), or would such an attacker need to write their own software?
When you have open-source software, it's a fine line between "configuring" and "writing".
Say you want to reject all attempts to spend a particular transaction. There isn't a command-line option or config file directive to do this in the standard Bitcoin Core distribution, so in that sense the answer is "no". But you can do it by adding two obvious lines of source code and recompiling, which is only marginally work than modifying a config file.
There is certainly no need to rewrite Bitcoin Core from scratch, if that's what you're asking. You can assume that if anyone is planning a 51% attack, the need to modify software is not going to be a significant obstacle.
I know that it would cost hundreds of millions of dollars to do a 51% attack on Bitcoin
or would such an attacker need to write their own software?
no new software/hardware is needed.