Yup I think too Gareth
I can't say I found the solution but I think it's kind round way that worked for me.
As I mentioned in the first post that I added some code in "header.php" which made a button but on the far right side of the search button.
This time I added some classes to that code, the same class that custom menu is using(found that using Dev tools). This made the menu move with the other menu items.
The limitation to this code is you can add a menu item, but it can be either as the 1st button in the menu or the last. You can't create a button in between them.
<?php echo $OUTPUT->custom_menu(); ?>If we add the code above to this it can be the 1st item in the menu or add after the above code it can be the last.
I hope this helps to someone.