#19356 added support for URI templates in MockMvcResultMatchers and as a consequence that encodes every expectedUrl value which previously were not. There is no need to change this existing behavior. Probably best to create a separate method explicitly named for use as a URI template so that you opt into the encoding. There is one comment under the ticket already.
Such a solution would also be aligned with a client side feature of the same kind under #20374.