So an airline orders a 777, but instead of the cockpit in that, they request the 787 cockpit installed in their 777, is this even doable?
I'll answer based on the one precedent I'm aware of. Yes. But whether the manufacturer agrees is up to them.
Which Honeywell then supplied for the MD-95 (later renamed Boeing 717) as well.
From Honeywell's press release:
Saudi Arabian Airlines (Saudia) has specified Honeywell's 8-by-8-inch flat panel liquid crystal displays for its new McDonnell Douglas MD-90 airliners.
In a separate development, Douglas has also decided to provide Honeywell's flat panel displays for the recently launched MD-95 aircraft program.
Regarding the specific 777/787 example, the 787 shares a lot already with the 777, which reduces the cost of training a 787 flight crew if they're already type-rated on the 777. Therefore, there's little incentive for both the airline and manufacturer to go that specific way.
For different reasons (not one airline's order) the 767-400ER comes with a 777-style cockpit, including the big displays.
The 767-400ER incorporates a new flight deck similar to that on the 777 (...) The overhead panels are largely unchanged (Boeing).
Is not possible to order a B777 with 787 flight deck style but... it's possible to order a B777x, that is developed exactly with this kind of flight deck.
This is possible. Aside from the question of how the new cockpit elements would fit into the older plane, the most important factors are how it affects performance and safety in the eyes of the regulators, and whether this is worth doing from a cost point of view. A large transport aircraft has a Type Certificate (TC) from the regulator that oversees its development (FAA in the USA, EASA in the EU). All the development and testing includes a list of exactly what is installed and how it was tested to show that it is all safe to fly. To modernise or replace some or all of a cockpit, even for a small part like a switch, the company that owns the TC has to prove to the regulator that all the safety and performance standards will still be met with the new (replacement) parts. The proof and justification will be proportional to the severity of the change. If the flight control computer for a Fly By Wire aircraft was being replaced with a new version, you can imagine there would be software changes, followed by flight testing and a lot of safety analysis to show everything worked as intended.
The more modern and complex the aircraft, the more expensive this process is, generally speaking. For the older MD-90s in the earlier example, it can be economically viable for a 3rd party to develop a Supplemental Type Certificate (even without the input of the original manufacturer) to add their equipment to the aircraft. This is often done with older aircraft to modernise equipment, especially in order to meet new regulations.