What do the regulations say?
The law says remarkably little.
You can download Approved Document P: electrical safety, dwellings
It says things like
P1. Reasonable provision shall be made in the design
and installation of electrical installations in order to
protect persons operating, maintaining or altering the
installations from fire or injury.
Additions and alterations to existing electrical installations
1.6 Regulation 4(3) states that when building work is complete, the building should be no more unsatisfactory in terms of complying with the applicable parts of Schedule 1 to the Building Regulations than before the building work was started. Therefore, when extending or altering an electrical installation, only the new work must meet current standards. There is no obligation to upgrade the existing installation unless either of the following applies.
a. The new work adversely affects the safety of the existing installation.
b. The state of the existing installation is such that the new work cannot be operated safely
Electrical installations should be designed and installed in accordance with BS 7671:2008 incorporating Amendment No 1:2011
Note that "should" is not "must". In practice, a DIYer or self-employed electrician would not have the resources to use another standard.
BS 7671 is a publication of the IET & BSI and can be purchased from the BSI for £85.
I'm not an electrician so I haven't purchased a copy, I'm reasonably sure that it permits consumer units in rooms containing a toilet and washbasin. BS 7671 is stricter about what goes in rooms containing a bath or shower.
The builder probably located it there because it was convenient (probably utility owned meter on other side of wall) and cheaper than putting it somewhere more sensible.
Note that the IET say
No, when installing a new circuit to an existing installation, after 1st January 2016, providing there is a spare way on the existing consumer unit, or if you utilise an existing way, there is no requirement to upgrade the consumer unit from a plastic product to a new metal type.
So adding new circuits is not sufficient justification by itself for relocating a consumer unit.