Replace $wgCommandLineMode checks with MW_ENTRY_POINT in other places
I'm not sure if there's a good way to split this up into logical chunks.
Bug: T313841 Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8