There’s an older smartapp which handled this particular situation by taking into account the amount of humidity in the bathroom. If the humidity is above a certain level, it assumes someone is taking a shower so the fact that the motion sensor doesn’t detect them doesn’t trigger the off.
I imagine these days you would do this with webcore instead, but the basic approach is interesting.