One of the things many mathematicians have trouble developing is what might be called "good taste" - a sense of what mathematics is genuinely interesting and can lead to further interesting developments. Some have so little taste that they declare that there is no such thing, and then claim the popularity of various research areas is driven purely by the entirely arbitrary decisions of famous mathematicians.
Good taste is important in research university level research for two reasons. First, if you are in an interesting research area, at some point all the problems you are working on will be solved or found intractable, and you will need to find new problems, and you will be doomed to obscurity if you pick bad problems. Second, at an R1, you are expected to have graduate students, and this means guiding them to good problems, at least good enough for them to write a dissertation. Hopefully, you will also help develop good taste in your students, which is easier if you have it yourself.
If you have good taste, it's hard to imagine that you will be working on something that's completely uninteresting to everyone in a large department, or something that's uninteresting to everyone in a collection of smaller departments (all of which presumably you'll want to apply to). (Matters could be different if you have some reasons, for example geographic ones, to want employment in a particular single small department.) You might not be working on anything that someone at the department is working on, but you'll be working on something that's interesting to someone. I might add that mathematics is more connected than one might think, and someone working in an apparently complete different area could be interested in your work because of some connection you don't know about. Keep in mind that departments rarely want to hire someone working on exactly the same topic that they already have someone working on, because you wouldn't be able to advise students the other person couldn't, and so on.
Now, it is very hard to evaluate good taste for someone at the point in their career where they are applying to tenure-track positions, and faculty are naturally likely to think their taste is good, so one can try to fake good taste by emulating the tastes of others. I suppose it's a strategy, but if you're willing to work on something you're not really interested in, why not go to industry and make more money?